Ignore:
Timestamp:
Jun 27, 2018, 3:28:41 PM (7 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
new-env, with_gc
Children:
b21c77a
Parents:
0182bfa (diff), 63238a4 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' into with_gc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/concurrency/kernel

    r0182bfa r28f3a19  
    2323extern "C" {
    2424#include <pthread.h>
     25#include <semaphore.h>
    2526}
    2627
     
    4344extern struct cluster * mainCluster;
    4445
    45 enum FinishOpCode { No_Action, Release, Schedule, Release_Schedule, Release_Multi, Release_Multi_Schedule };
     46enum FinishOpCode { No_Action, Release, Schedule, Release_Schedule, Release_Multi, Release_Multi_Schedule, Callback };
     47
     48typedef void (*__finish_callback_fptr_t)(void);
    4649
    4750//TODO use union, many of these fields are mutually exclusive (i.e. MULTI vs NOMULTI)
    4851struct FinishAction {
    4952        FinishOpCode action_code;
     53        /*
     54        // Union of possible actions
     55        union {
     56                // Option 1 : locks and threads
     57                struct {
     58                        // 1 thread or N thread
     59                        union {
     60                                thread_desc * thrd;
     61                                struct {
     62                                        thread_desc ** thrds;
     63                                        unsigned short thrd_count;
     64                                };
     65                        };
     66                        // 1 lock or N lock
     67                        union {
     68                                __spinlock_t * lock;
     69                                struct {
     70                                        __spinlock_t ** locks;
     71                                        unsigned short lock_count;
     72                                };
     73                        };
     74                };
     75                // Option 2 : action pointer
     76                __finish_callback_fptr_t callback;
     77        };
     78        /*/
    5079        thread_desc * thrd;
     80        thread_desc ** thrds;
     81        unsigned short thrd_count;
    5182        __spinlock_t * lock;
    5283        __spinlock_t ** locks;
    5384        unsigned short lock_count;
    54         thread_desc ** thrds;
    55         unsigned short thrd_count;
     85        __finish_callback_fptr_t callback;
     86        //*/
    5687};
    5788static inline void ?{}(FinishAction & this) {
     
    82113        pthread_t kernel_thread;
    83114
     115        // RunThread data
     116        // Action to do after a thread is ran
     117        struct FinishAction finish;
     118
     119        // Preemption data
     120        // Node which is added in the discrete event simulaiton
     121        struct alarm_node_t * preemption_alarm;
     122
     123        // If true, a preemption was triggered in an unsafe region, the processor must preempt as soon as possible
     124        bool pending_preemption;
     125
     126        // Idle lock
     127        __bin_sem_t idleLock;
     128
    84129        // Termination
    85130        // Set to true to notify the processor should terminate
     
    89134        semaphore terminated;
    90135
    91         // RunThread data
    92         // Action to do after a thread is ran
    93         struct FinishAction finish;
    94 
    95         // Preemption data
    96         // Node which is added in the discrete event simulaiton
    97         struct alarm_node_t * preemption_alarm;
    98 
    99         // If true, a preemption was triggered in an unsafe region, the processor must preempt as soon as possible
    100         bool pending_preemption;
    101 
    102         // Idle lock
    103 
    104136        // Link lists fields
    105         struct {
     137        struct __dbg_node_proc {
    106138                struct processor * next;
    107139                struct processor * prev;
     
    150182
    151183        // Link lists fields
    152         struct {
     184        struct __dbg_node_cltr {
    153185                cluster * next;
    154186                cluster * prev;
Note: See TracChangeset for help on using the changeset viewer.