Changeset 4ecc35a
- Timestamp:
- Mar 21, 2022, 1:28:59 PM (3 years ago)
- Branches:
- ADT, ast-experimental, enum, master, pthread-emulation, qualifiedEnum
- Children:
- dbe2533
- Parents:
- 98d1b90
- Location:
- libcfa/src/concurrency
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/io.cfa
r98d1b90 r4ecc35a 93 93 extern void __kernel_unpark( thread$ * thrd, unpark_hint ); 94 94 95 bool __cfa_io_drain( processor * proc) {95 bool __cfa_io_drain( $io_context * ctx ) { 96 96 /* paranoid */ verify( ! __preemption_enabled() ); 97 97 /* paranoid */ verify( ready_schedule_islocked() ); 98 /* paranoid */ verify( proc ); 99 /* paranoid */ verify( proc->io.ctx ); 98 /* paranoid */ verify( ctx ); 100 99 101 100 // Drain the queue 102 $io_context * ctx = proc->io.ctx;103 101 unsigned head = *ctx->cq.head; 104 102 unsigned tail = *ctx->cq.tail; … … 110 108 if(count == 0) return false; 111 109 110 if(!__atomic_try_acquire(&ctx->cq.lock)) { 111 return false; 112 } 113 112 114 for(i; count) { 113 115 unsigned idx = (head + i) & mask; … … 130 132 /* paranoid */ verify( ready_schedule_islocked() ); 131 133 /* paranoid */ verify( ! __preemption_enabled() ); 134 135 __atomic_unlock(&ctx->cq.lock); 132 136 133 137 return true; … … 179 183 180 184 ready_schedule_lock(); 181 bool ret = __cfa_io_drain( proc);185 bool ret = __cfa_io_drain( &ctx ); 182 186 ready_schedule_unlock(); 183 187 return ret; -
libcfa/src/concurrency/io/setup.cfa
r98d1b90 r4ecc35a 214 214 215 215 // completion queue 216 cq.lock = 0; 216 217 cq.head = (volatile __u32 *)(((intptr_t)cq.ring_ptr) + params.cq_off.head); 217 218 cq.tail = (volatile __u32 *)(((intptr_t)cq.ring_ptr) + params.cq_off.tail); -
libcfa/src/concurrency/io/types.hfa
r98d1b90 r4ecc35a 78 78 79 79 struct __cmp_ring_t { 80 volatile bool lock; 81 80 82 // Head and tail of the ring 81 83 volatile __u32 * head; -
libcfa/src/concurrency/kernel.cfa
r98d1b90 r4ecc35a 136 136 static void mark_awake(__cluster_proc_list & idles, processor & proc); 137 137 138 extern bool __cfa_io_drain( processor* );138 extern bool __cfa_io_drain( $io_context * ); 139 139 extern bool __cfa_io_flush( processor *, int min_comp ); 140 140 static inline bool __maybe_io_drain( processor * ); … … 839 839 if(head == tail) return false; 840 840 ready_schedule_lock(); 841 ret = __cfa_io_drain( proc);841 ret = __cfa_io_drain( ctx ); 842 842 ready_schedule_unlock(); 843 843 #endif
Note: See TracChangeset
for help on using the changeset viewer.