Changeset 8e4aa05 for libcfa/src/concurrency/kernel.hfa
- Timestamp:
- Mar 4, 2021, 7:40:25 PM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 77d601f
- Parents:
- 342af53 (diff), a5040fe (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/kernel.hfa
r342af53 r8e4aa05 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // kernel -- 7 // kernel -- Header containing the core of the kernel API 8 8 // 9 9 // Author : Thierry Delisle … … 24 24 extern "C" { 25 25 #include <bits/pthreadtypes.h> 26 #include <pthread.h> 26 27 #include <linux/types.h> 27 28 } 28 29 29 //----------------------------------------------------------------------------- 30 // Locks 31 struct semaphore { 32 __spinlock_t lock; 33 int count; 34 __queue_t($thread) waiting; 35 }; 36 37 void ?{}(semaphore & this, int count = 1); 38 void ^?{}(semaphore & this); 39 bool P (semaphore & this); 40 bool V (semaphore & this); 41 bool V (semaphore & this, unsigned count); 42 30 #ifdef __CFA_WITH_VERIFY__ 31 extern bool __cfaabi_dbg_in_kernel(); 32 #endif 33 34 //----------------------------------------------------------------------------- 35 // I/O 36 struct cluster; 37 struct $io_context; 38 struct $io_arbiter; 39 40 struct io_context_params { 41 int num_entries; 42 }; 43 44 void ?{}(io_context_params & this); 43 45 44 46 //----------------------------------------------------------------------------- … … 80 82 pthread_t kernel_thread; 81 83 84 struct { 85 $io_context * ctx; 86 bool pending; 87 bool dirty; 88 } io; 89 82 90 // Preemption data 83 91 // Node which is added in the discrete event simulaiton … … 88 96 89 97 // Idle lock (kernel semaphore) 90 __bin_sem_t idle;98 int idle; 91 99 92 100 // Termination synchronisation (user semaphore) 93 semaphoreterminated;101 oneshot terminated; 94 102 95 103 // pthread Stack … … 118 126 119 127 DLISTED_MGD_IMPL_OUT(processor) 120 121 //-----------------------------------------------------------------------------122 // I/O123 struct __io_data;124 125 // IO poller user-thread126 // Not using the "thread" keyword because we want to control127 // more carefully when to start/stop it128 struct $io_ctx_thread {129 struct __io_data * ring;130 single_sem sem;131 volatile bool done;132 $thread self;133 };134 135 136 struct io_context {137 $io_ctx_thread thrd;138 };139 140 struct io_context_params {141 int num_entries;142 int num_ready;143 int submit_aff;144 bool eager_submits:1;145 bool poller_submits:1;146 bool poll_submit:1;147 bool poll_complete:1;148 };149 150 void ?{}(io_context_params & this);151 152 void ?{}(io_context & this, struct cluster & cl);153 void ?{}(io_context & this, struct cluster & cl, const io_context_params & params);154 void ^?{}(io_context & this);155 156 struct io_cancellation {157 __u64 target;158 };159 160 static inline void ?{}(io_cancellation & this) { this.target = -1u; }161 static inline void ^?{}(io_cancellation &) {}162 bool cancel(io_cancellation & this);163 128 164 129 //----------------------------------------------------------------------------- … … 246 211 247 212 struct { 248 io_context * ctxs;249 unsigned cnt;213 $io_arbiter * arbiter; 214 io_context_params params; 250 215 } io; 251 216
Note:
See TracChangeset
for help on using the changeset viewer.