Changeset 3caf5e3
- Timestamp:
- Mar 23, 2022, 1:23:17 PM (3 years ago)
- Branches:
- ADT, ast-experimental, enum, master, pthread-emulation, qualifiedEnum
- Children:
- 202c80b, 94fa946
- Parents:
- 1a567d0
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/io.cfa
r1a567d0 r3caf5e3 99 99 /* paranoid */ verify( ctx ); 100 100 101 const __u32 mask = *ctx->cq.mask; 102 103 104 { 105 const __u32 head = *ctx->cq.head; 106 const __u32 tail = *ctx->cq.tail; 107 108 if(head == tail) return false; 109 } 110 101 111 // Drain the queue 102 unsigned head = *ctx->cq.head;103 unsigned tail = *ctx->cq.tail;104 const __u32 mask = *ctx->cq.mask;105 106 __u32 count = tail - head;107 __STATS__( false, io.calls.drain++; io.calls.completed += count; )108 109 if(count == 0) return false;110 111 112 if(!__atomic_try_acquire(&ctx->cq.lock)) { 112 113 return false; … … 114 115 115 116 unsigned long long ts_prev = ctx->cq.ts; 117 118 // re-read the head and tail in case it already changed. 119 const __u32 head = *ctx->cq.head; 120 const __u32 tail = *ctx->cq.tail; 121 const __u32 count = tail - head; 122 __STATS__( false, io.calls.drain++; io.calls.completed += count; ) 116 123 117 124 for(i; count) {
Note: See TracChangeset
for help on using the changeset viewer.