Ignore:
File:
1 edited

Legend:

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

    rae7be7a rd72c074  
    4848                extern __attribute__((aligned(128))) thread_local struct KernelThreadData {
    4949                        struct $thread    * volatile this_thread;
    50                         struct processor      * volatile this_processor;
     50                        struct processor  * volatile this_processor;
     51                        struct __stats_t  * volatile this_stats;
    5152
    5253                        struct {
     
    5657                        } preemption_state;
    5758
    58                         uint32_t rand_seed;
     59                        __uint128_t rand_seed;
    5960                } kernelTLS __attribute__ ((tls_model ( "initial-exec" )));
    6061        }
     
    9293        };
    9394
    94         enum coroutine_state { Halted, Start, Primed, Blocked, Ready, Active, Rerun };
     95        enum __Coroutine_State { Halted, Start, Primed, Blocked, Ready, Active };
    9596        enum __Preemption_Reason { __NO_PREEMPTION, __ALARM_PREEMPTION, __POLL_PREEMPTION, __MANUAL_PREEMPTION };
    9697
     
    106107
    107108                // current execution status for coroutine
    108                 enum coroutine_state state;
     109                enum __Coroutine_State state;
    109110
    110111                // first coroutine to resume this one
     
    161162        };
    162163
     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
    163173        struct $thread {
    164174                // Core threading fields
     
    167177
    168178                // current execution status for coroutine
    169                 volatile int state;
    170                 enum __Preemption_Reason preempted;
     179                volatile int ticket;
     180                enum __Coroutine_State state:8;
     181                enum __Preemption_Reason preempted:8;
    171182
    172183                //SKULLDUGGERY errno is not save in the thread data structure because returnToKernel appears to be the only function to require saving and restoring it
     184
     185                // pointer to the cluster on which the thread is running
     186                struct cluster * curr_cluster;
     187
     188                // Link lists fields
     189                // instrusive link field for threads
     190                struct __thread_desc_link link;
    173191
    174192                // coroutine body used to store context
     
    184202                struct $monitor *  self_mon_p;
    185203
    186                 // pointer to the cluster on which the thread is running
    187                 struct cluster * curr_cluster;
    188 
    189204                // monitors currently held by this thread
    190205                struct __monitor_group_t monitors;
    191 
    192                 // Link lists fields
    193                 // instrusive link field for threads
    194                 struct $thread * next;
    195206
    196207                struct {
     
    202213                        // previous function to park/unpark the thread
    203214                        const char * park_caller;
    204                         enum coroutine_state park_result;
     215                        int park_result;
     216                        enum __Coroutine_State park_state;
    205217                        bool park_stale;
    206218                        const char * unpark_caller;
    207                         enum coroutine_state unpark_result;
     219                        int unpark_result;
     220                        enum __Coroutine_State unpark_state;
    208221                        bool unpark_stale;
    209222                #endif
     
    218231        #ifdef __cforall
    219232        extern "Cforall" {
     233
    220234                static inline $thread *& get_next( $thread & this ) __attribute__((const)) {
    221                         return this.next;
     235                        return this.link.next;
    222236                }
    223237
Note: See TracChangeset for help on using the changeset viewer.