Changeset 3caf5e3


Ignore:
Timestamp:
Mar 23, 2022, 1:23:17 PM (3 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, ast-experimental, enum, master, pthread-emulation, qualifiedEnum
Children:
202c80b, 94fa946
Parents:
1a567d0
Message:

Re-read cq information after acquire. Hoping this is the cause for the build failure

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/io.cfa

    r1a567d0 r3caf5e3  
    9999                /* paranoid */ verify( ctx );
    100100
     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
    101111                // 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 
    111112                if(!__atomic_try_acquire(&ctx->cq.lock)) {
    112113                        return false;
     
    114115
    115116                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; )
    116123
    117124                for(i; count) {
Note: See TracChangeset for help on using the changeset viewer.