Ignore:
Timestamp:
Mar 28, 2017, 1:03:01 PM (7 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
72dc82a
Parents:
f32a013
Message:

First step in implementing internal scheduling

File:
1 edited

Legend:

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

    rf32a013 r690f13c  
    294294// Scheduler routines
    295295void ScheduleThread( thread_desc * thrd ) {
     296        if( !thrd ) return;
     297
    296298        assertf( thrd->next == NULL, "Expected null got %p", thrd->next );
    297299       
     
    468470        return head;
    469471}
     472
     473void ?{}( simple_thread_stack * this ) {
     474        this->top = NULL;
     475}
     476
     477void push( simple_thread_stack * this, thread_desc * t ) {
     478        assert(t->next != NULL);
     479        t->next = this->top;
     480        this->top = t;
     481}
     482
     483thread_desc * pop( simple_thread_stack * this ) {
     484        thread_desc * top = this->top;
     485        if( top ) {
     486                this->top = top->next;
     487                top->next = NULL;
     488        }       
     489        return top;
     490}
    470491// Local Variables: //
    471492// mode: c //
Note: See TracChangeset for help on using the changeset viewer.