Changes in / [47b5b63:d22e90f]


Ignore:
Location:
src/libcfa/concurrency
Files:
4 edited

Legend:

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

    r47b5b63 rd22e90f  
    6565        this.errno_ = 0;
    6666        this.state = Start;
    67         this.starter = this_coroutine;
     67        this.starter = NULL;
    6868        this.last = NULL;
    6969}
     
    171171                suspend();
    172172        }
    173 
    174         void __leave_coroutine(void) {
    175                 coroutine_desc * src = this_coroutine;          // optimization
    176 
    177                 assertf( src->starter != 0,
    178                         "Attempt to suspend coroutine \"%.256s\" (%p) that does not have a starter.\n"
    179                         "Possible cause is a resume of a coroutine already destroyed or not yet constructed",
    180                         src->name, src );
    181                 assertf( src->starter->state != Halted,
    182                         "Attempt by coroutine \"%.256s\" (%p) to suspend back to terminated coroutine \"%.256s\" (%p).\n"
    183                         "Possible cause is terminated coroutine's main routine has already returned.",
    184                         src->name, src, src->starter->name, src->starter );
    185 
    186                 CoroutineCtxSwitch( src, src->starter );
    187         }
    188173}
    189174
  • src/libcfa/concurrency/invoke.c

    r47b5b63 rd22e90f  
    2828
    2929extern void __suspend_internal(void);
    30 extern void __leave_coroutine(void);
    3130extern void __leave_thread_monitor( struct thread_desc * this );
    3231extern void disable_interrupts();
     
    5352
    5453      //Final suspend, should never return
    55       __leave_coroutine();
     54      __suspend_internal();
    5655      abortf("Resumed dead coroutine");
    5756}
  • src/libcfa/concurrency/invoke.h

    r47b5b63 rd22e90f  
    8080            int errno_;                               // copy of global UNIX variable errno
    8181            enum coroutine_state state;               // current execution status for coroutine
    82             struct coroutine_desc * starter;          // first coroutine to resume this one
    83             struct coroutine_desc * last;             // last coroutine to resume this one
     82            struct coroutine_desc *starter;           // first coroutine to resume this one
     83            struct coroutine_desc *last;                    // last coroutine to resume this one
    8484      };
    8585
  • src/libcfa/concurrency/kernel.c

    r47b5b63 rd22e90f  
    102102        this.errno_ = 0;
    103103        this.state = Start;
    104         this.starter = NULL;
    105104}
    106105
     
    111110//-----------------------------------------------------------------------------
    112111// Processor coroutine
    113 
    114 // Construct the processor context of the main processor
    115112void ?{}(processorCtx_t & this, processor * proc) {
    116113        (this.__cor){ "Processor" };
    117         this.__cor.starter = &mainThread->cor;
    118114        this.proc = proc;
    119115        proc->runner = &this;
    120116}
    121117
    122 // Construct the processor context of non-main processors
    123118void ?{}(processorCtx_t & this, processor * proc, current_stack_info_t * info) {
    124119        (this.__cor){ info };
Note: See TracChangeset for help on using the changeset viewer.