Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/coroutine.cfa

    rc960331 r290553a  
    1010// Created On       : Mon Nov 28 12:27:26 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Oct 23 23:05:24 2020
    13 // Update Count     : 22
     12// Last Modified On : Tue May 26 22:06:09 2020
     13// Update Count     : 21
    1414//
    1515
     
    2424#include <unistd.h>
    2525#include <sys/mman.h>                                                                   // mprotect
     26extern "C" {
     27// use this define to make unwind.h play nice, definitely a hack
     28#define HIDE_EXPORTS
    2629#include <unwind.h>
     30#undef HIDE_EXPORTS
     31}
    2732
    2833#include "kernel_private.hfa"
    29 #include "exception.hfa"
    3034
    3135#define __CFA_INVOKE_PRIVATE__
     
    4549FORALL_DATA_INSTANCE(CoroutineCancelled, (dtype coroutine_t), (coroutine_t))
    4650
     51struct __cfaehm_node {
     52        struct _Unwind_Exception unwind_exception;
     53        struct __cfaehm_node * next;
     54        int handler_index;
     55};
     56
    4757forall(dtype T)
    4858void mark_exception(CoroutineCancelled(T) *) {}
     
    5060forall(dtype T)
    5161void copy(CoroutineCancelled(T) * dst, CoroutineCancelled(T) * src) {
    52         dst->virtual_table = src->virtual_table;
    5362        dst->the_coroutine = src->the_coroutine;
    5463        dst->the_exception = src->the_exception;
     
    6574        verify( desc->cancellation );
    6675        desc->state = Cancelled;
    67         exception_t * except = __cfaehm_cancellation_exception( desc->cancellation );
     76        exception_t * except = (exception_t *)(1 + (__cfaehm_node *)desc->cancellation);
    6877
    6978        // TODO: Remove explitate vtable set once trac#186 is fixed.
     
    208217                size = libFloor(create_size - stack_data_size - diff, libAlign());
    209218        } // if
    210         assertf( size >= MinStackSize, "Stack size %zd provides less than minimum of %zd bytes for a stack.", size, MinStackSize );
     219        assertf( size >= MinStackSize, "Stack size %zd provides less than minimum of %d bytes for a stack.", size, MinStackSize );
    211220
    212221        this->storage = (__stack_t *)((intptr_t)storage + size);
Note: See TracChangeset for help on using the changeset viewer.