Ignore:
File:
1 edited

Legend:

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

    r1c01c58 rd119d613  
    4747
    4848//-----------------------------------------------------------------------------
    49 FORALL_DATA_INSTANCE(CoroutineCancelled,
    50                 (dtype coroutine_t | sized(coroutine_t)), (coroutine_t))
    51 
    52 struct __cfaehm_node {
    53         struct _Unwind_Exception unwind_exception;
    54         struct __cfaehm_node * next;
    55         int handler_index;
    56 };
    57 
    58 forall(dtype T)
    59 void mark_exception(CoroutineCancelled(T) *) {}
    60 
    61 forall(dtype T | sized(T))
    62 void copy(CoroutineCancelled(T) * dst, CoroutineCancelled(T) * src) {
    63         dst->the_coroutine = src->the_coroutine;
    64         dst->the_exception = src->the_exception;
    65 }
    66 
    67 forall(dtype T)
    68 const char * msg(CoroutineCancelled(T) *) {
    69         return "CoroutineCancelled(...)";
    70 }
    71 
    72 // This code should not be inlined. It is the error path on resume.
    73 forall(dtype T | is_coroutine(T))
    74 void __cfaehm_cancelled_coroutine( T & cor, $coroutine * desc ) {
    75         verify( desc->cancellation );
    76         desc->state = Cancelled;
    77         exception_t * except = (exception_t *)(1 + (__cfaehm_node *)desc->cancellation);
    78 
    79         CoroutineCancelled(T) except;
    80         except.the_coroutine = &cor;
    81         except.the_exception = except;
    82         throwResume except;
    83 
    84         except->virtual_table->free( except );
    85         free( desc->cancellation );
    86         desc->cancellation = 0p;
    87 }
    88 
    89 //-----------------------------------------------------------------------------
    9049// Global state variables
    9150
     
    221180        this->storage->limit = storage;
    222181        this->storage->base  = (void*)((intptr_t)storage + size);
    223         this->storage->exception_context.top_resume = 0p;
    224         this->storage->exception_context.current_exception = 0p;
    225182        __attribute__((may_alias)) intptr_t * istorage = (intptr_t*)&this->storage;
    226183        *istorage |= userStack ? 0x1 : 0x0;
Note: See TracChangeset for help on using the changeset viewer.