Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/concurrency/invoke.h

    ree897e4b r0157ca7  
    3030      #define SCHEDULER_CAPACITY 10
    3131
    32       struct spinlock {
    33             volatile int lock;
    34       };
    35 
    3632      struct simple_thread_list {
    3733            struct thread * head;
    3834            struct thread ** tail;
    39       };
    40 
    41       struct signal_once {
    42             volatile bool condition;
    43             struct spinlock lock;
    44             struct simple_thread_list blocked;
    4535      };
    4636
     
    5040            void append( struct simple_thread_list *, struct thread * );
    5141            struct thread * pop_head( struct simple_thread_list * );
    52 
    53             void ?{}(spinlock * this);
    54             void ^?{}(spinlock * this);
    55 
    56             void ?{}(signal_once * this);
    57             void ^?{}(signal_once * this);
    5842      }
    5943      #endif
     
    6953      };
    7054
    71       enum coroutine_state { Halted, Start, Inactive, Active, Primed };
     55      enum coroutine_state { Start, Inactive, Active, Halt, Primed };
    7256
    7357      struct coroutine {
     
    7660            int errno_;                         // copy of global UNIX variable errno
    7761            enum coroutine_state state; // current execution status for coroutine
     62            bool notHalted;                     // indicate if execuation state is not halted
     63
    7864            struct coroutine *starter;  // first coroutine to resume this one
    7965            struct coroutine *last;             // last coroutine to resume this one
    8066      };
    8167
     68      struct simple_lock {
     69        struct simple_thread_list blocked;
     70      };
     71
    8272      struct thread {
    83             struct coroutine c;           // coroutine body used to store context
    84             struct signal_once terminated;// indicate if execuation state is not halted
    85             struct thread * next;         // instrusive link field for threads
     73            struct coroutine c;
     74            struct simple_lock lock;
     75            struct thread * next;
    8676      };
    8777
Note: See TracChangeset for help on using the changeset viewer.