Changeset d529ad0


Ignore:
Timestamp:
Mar 3, 2022, 3:17:05 PM (2 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, ast-experimental, enum, master, pthread-emulation, qualifiedEnum
Children:
fc01219
Parents:
9cd44ba
Message:

Pending/Dirty? flags now use relaxed atomics since they can be set remotely

Location:
libcfa/src/concurrency
Files:
3 edited

Legend:

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

    r9cd44ba rd529ad0  
    175175                        /* paranoid */ verify( ! __preemption_enabled() );
    176176
    177                         ctx.proc->io.pending = false;
     177                        __atomic_store_n(&ctx.proc->io.pending, false, __ATOMIC_RELAXED);
    178178                }
    179179
     
    304304                sq.to_submit += have;
    305305
    306                 ctx->proc->io.pending = true;
    307                 ctx->proc->io.dirty   = true;
     306                __atomic_store_n(&ctx->proc->io.pending, true, __ATOMIC_RELAXED);
     307                __atomic_store_n(&ctx->proc->io.dirty  , true, __ATOMIC_RELAXED);
    308308        }
    309309
     
    499499                bool we = enqueue(ctx->ext_sq, (__outstanding_io&)ei);
    500500
    501                 ctx->proc->io.pending = true;
     501                __atomic_store_n(&ctx->proc->io.pending, true, __ATOMIC_SEQ_CST);
    502502
    503503                if( we ) {
  • libcfa/src/concurrency/kernel.cfa

    r9cd44ba rd529ad0  
    251251                        if( __atomic_load_n(&this->do_terminate, __ATOMIC_SEQ_CST) ) break MAIN_LOOP;
    252252
    253                         if(this->io.pending && !this->io.dirty) {
     253                        if(__atomic_load_n(&this->io.pending, __ATOMIC_RELAXED) && !__atomic_load_n(&this->io.dirty, __ATOMIC_RELAXED)) {
    254254                                __IO_STATS__(true, io.flush.dirty++; )
    255255                                __cfa_io_flush( this, 0 );
  • libcfa/src/concurrency/kernel.hfa

    r9cd44ba rd529ad0  
    9292        struct {
    9393                $io_context * ctx;
    94                 bool pending;
    95                 bool dirty;
     94                volatile bool pending;
     95                volatile bool dirty;
    9696        } io;
    9797
Note: See TracChangeset for help on using the changeset viewer.