Ignore:
File:
1 edited

Legend:

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

    rac2b598 r09d4b22  
    4747        extern "Cforall" {
    4848                extern __attribute__((aligned(128))) thread_local struct KernelThreadData {
    49                         struct $thread    * volatile this_thread;
     49                        struct thread_desc    * volatile this_thread;
    5050                        struct processor      * volatile this_processor;
    5151
     
    9292        };
    9393
    94         enum coroutine_state { Halted, Start, Primed, Inactive, Active, Rerun };
    95         enum __Preemption_Reason { __NO_PREEMPTION, __ALARM_PREEMPTION, __POLL_PREEMPTION, __MANUAL_PREEMPTION };
    96 
    97         struct $coroutine {
    98                 // context that is switch during a __cfactx_switch
     94        enum coroutine_state { Halted, Start, Inactive, Active, Primed };
     95
     96        struct coroutine_desc {
     97                // context that is switch during a CtxSwitch
    9998                struct __stack_context_t context;
    10099
     
    109108
    110109                // first coroutine to resume this one
    111                 struct $coroutine * starter;
     110                struct coroutine_desc * starter;
    112111
    113112                // last coroutine to resume this one
    114                 struct $coroutine * last;
     113                struct coroutine_desc * last;
    115114
    116115                // If non-null stack must be unwound with this exception
     
    128127        };
    129128
    130         struct $monitor {
     129        struct monitor_desc {
    131130                // spinlock to protect internal data
    132131                struct __spinlock_t lock;
    133132
    134133                // current owner of the monitor
    135                 struct $thread * owner;
     134                struct thread_desc * owner;
    136135
    137136                // queue of threads that are blocked waiting for the monitor
    138                 __queue_t(struct $thread) entry_queue;
     137                __queue_t(struct thread_desc) entry_queue;
    139138
    140139                // stack of conditions to run next once we exit the monitor
     
    153152        struct __monitor_group_t {
    154153                // currently held monitors
    155                 __cfa_anonymous_object( __small_array_t($monitor*) );
     154                __cfa_anonymous_object( __small_array_t(monitor_desc*) );
    156155
    157156                // last function that acquired monitors
     
    159158        };
    160159
    161         struct $thread {
     160        struct thread_desc {
    162161                // Core threading fields
    163                 // context that is switch during a __cfactx_switch
     162                // context that is switch during a CtxSwitch
    164163                struct __stack_context_t context;
    165164
    166165                // current execution status for coroutine
    167                 volatile int state;
    168                 enum __Preemption_Reason preempted;
     166                enum coroutine_state state;
    169167
    170168                //SKULLDUGGERY errno is not save in the thread data structure because returnToKernel appears to be the only function to require saving and restoring it
    171169
    172170                // coroutine body used to store context
    173                 struct $coroutine  self_cor;
     171                struct coroutine_desc  self_cor;
    174172
    175173                // current active context
    176                 struct $coroutine * curr_cor;
     174                struct coroutine_desc * curr_cor;
    177175
    178176                // monitor body used for mutual exclusion
    179                 struct $monitor    self_mon;
     177                struct monitor_desc    self_mon;
    180178
    181179                // pointer to monitor with sufficient lifetime for current monitors
    182                 struct $monitor *  self_mon_p;
     180                struct monitor_desc *  self_mon_p;
    183181
    184182                // pointer to the cluster on which the thread is running
     
    190188                // Link lists fields
    191189                // instrusive link field for threads
    192                 struct $thread * next;
     190                struct thread_desc * next;
    193191
    194192                struct {
    195                         struct $thread * next;
    196                         struct $thread * prev;
     193                        struct thread_desc * next;
     194                        struct thread_desc * prev;
    197195                } node;
    198196        };
     
    200198        #ifdef __cforall
    201199        extern "Cforall" {
    202                 static inline $thread *& get_next( $thread & this ) __attribute__((const)) {
     200                static inline thread_desc *& get_next( thread_desc & this ) {
    203201                        return this.next;
    204202                }
    205203
    206                 static inline [$thread *&, $thread *& ] __get( $thread & this ) __attribute__((const)) {
     204                static inline [thread_desc *&, thread_desc *& ] __get( thread_desc & this ) {
    207205                        return this.node.[next, prev];
    208206                }
     
    214212                }
    215213
    216                 static inline void ?{}(__monitor_group_t & this, struct $monitor ** data, __lock_size_t size, fptr_t func) {
     214                static inline void ?{}(__monitor_group_t & this, struct monitor_desc ** data, __lock_size_t size, fptr_t func) {
    217215                        (this.data){data};
    218216                        (this.size){size};
     
    220218                }
    221219
    222                 static inline bool ?==?( const __monitor_group_t & lhs, const __monitor_group_t & rhs ) __attribute__((const)) {
     220                static inline bool ?==?( const __monitor_group_t & lhs, const __monitor_group_t & rhs ) {
    223221                        if( (lhs.data != 0) != (rhs.data != 0) ) return false;
    224222                        if( lhs.size != rhs.size ) return false;
     
    254252
    255253        // assembler routines that performs the context switch
    256         extern void __cfactx_invoke_stub( void );
    257         extern void __cfactx_switch( struct __stack_context_t * from, struct __stack_context_t * to ) asm ("__cfactx_switch");
     254        extern void CtxInvokeStub( void );
     255        extern void CtxSwitch( struct __stack_context_t * from, struct __stack_context_t * to ) asm ("CtxSwitch");
    258256        // void CtxStore ( void * this ) asm ("CtxStore");
    259257        // void CtxRet   ( void * dst  ) asm ("CtxRet");
Note: See TracChangeset for help on using the changeset viewer.