Ignore:
File:
1 edited

Legend:

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

    rd72c074 rae7be7a  
    4848                extern __attribute__((aligned(128))) thread_local struct KernelThreadData {
    4949                        struct $thread    * volatile this_thread;
    50                         struct processor  * volatile this_processor;
    51                         struct __stats_t  * volatile this_stats;
     50                        struct processor      * volatile this_processor;
    5251
    5352                        struct {
     
    5756                        } preemption_state;
    5857
    59                         __uint128_t rand_seed;
     58                        uint32_t rand_seed;
    6059                } kernelTLS __attribute__ ((tls_model ( "initial-exec" )));
    6160        }
     
    9392        };
    9493
    95         enum __Coroutine_State { Halted, Start, Primed, Blocked, Ready, Active };
     94        enum coroutine_state { Halted, Start, Primed, Blocked, Ready, Active, Rerun };
    9695        enum __Preemption_Reason { __NO_PREEMPTION, __ALARM_PREEMPTION, __POLL_PREEMPTION, __MANUAL_PREEMPTION };
    9796
     
    107106
    108107                // current execution status for coroutine
    109                 enum __Coroutine_State state;
     108                enum coroutine_state state;
    110109
    111110                // first coroutine to resume this one
     
    162161        };
    163162
    164         // Link lists fields
    165         // instrusive link field for threads
    166         struct __thread_desc_link {
    167                 struct $thread * next;
    168                 struct $thread * prev;
    169                 volatile unsigned long long ts;
    170                 int preferred;
    171         };
    172 
    173163        struct $thread {
    174164                // Core threading fields
     
    177167
    178168                // current execution status for coroutine
    179                 volatile int ticket;
    180                 enum __Coroutine_State state:8;
    181                 enum __Preemption_Reason preempted:8;
     169                volatile int state;
     170                enum __Preemption_Reason preempted;
    182171
    183172                //SKULLDUGGERY errno is not save in the thread data structure because returnToKernel appears to be the only function to require saving and restoring it
     173
     174                // coroutine body used to store context
     175                struct $coroutine  self_cor;
     176
     177                // current active context
     178                struct $coroutine * curr_cor;
     179
     180                // monitor body used for mutual exclusion
     181                struct $monitor    self_mon;
     182
     183                // pointer to monitor with sufficient lifetime for current monitors
     184                struct $monitor *  self_mon_p;
    184185
    185186                // pointer to the cluster on which the thread is running
    186187                struct cluster * curr_cluster;
    187188
     189                // monitors currently held by this thread
     190                struct __monitor_group_t monitors;
     191
    188192                // Link lists fields
    189193                // instrusive link field for threads
    190                 struct __thread_desc_link link;
    191 
    192                 // coroutine body used to store context
    193                 struct $coroutine  self_cor;
    194 
    195                 // current active context
    196                 struct $coroutine * curr_cor;
    197 
    198                 // monitor body used for mutual exclusion
    199                 struct $monitor    self_mon;
    200 
    201                 // pointer to monitor with sufficient lifetime for current monitors
    202                 struct $monitor *  self_mon_p;
    203 
    204                 // monitors currently held by this thread
    205                 struct __monitor_group_t monitors;
     194                struct $thread * next;
    206195
    207196                struct {
     
    213202                        // previous function to park/unpark the thread
    214203                        const char * park_caller;
    215                         int park_result;
    216                         enum __Coroutine_State park_state;
     204                        enum coroutine_state park_result;
    217205                        bool park_stale;
    218206                        const char * unpark_caller;
    219                         int unpark_result;
    220                         enum __Coroutine_State unpark_state;
     207                        enum coroutine_state unpark_result;
    221208                        bool unpark_stale;
    222209                #endif
     
    231218        #ifdef __cforall
    232219        extern "Cforall" {
    233 
    234220                static inline $thread *& get_next( $thread & this ) __attribute__((const)) {
    235                         return this.link.next;
     221                        return this.next;
    236222                }
    237223
Note: See TracChangeset for help on using the changeset viewer.