Changeset c1c95b1


Ignore:
Timestamp:
Apr 24, 2021, 6:07:42 PM (3 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
3bd4293, c6c7e6c
Parents:
986cb99
Message:

io_drain now returns true if anything was unparked

Location:
libcfa/src/concurrency
Files:
2 edited

Legend:

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

    r986cb99 rc1c95b1  
    9090        static inline __u32 __release_sqes( struct $io_context & );
    9191
    92         void __cfa_io_drain( processor * proc ) {
     92        bool __cfa_io_drain( processor * proc ) {
    9393                /* paranoid */ verify( ! __preemption_enabled() );
    9494                /* paranoid */ verify( proc );
     
    104104                __STATS__( false, io.calls.drain++; io.calls.completed += count; )
    105105
     106                if(count == 0) return false;
     107
    106108                for(i; count) {
    107109                        unsigned idx = (head + i) & mask;
     
    124126                /* paranoid */ verify( ! __preemption_enabled() );
    125127
    126                 return;
     128                return true;
    127129        }
    128130
  • libcfa/src/concurrency/kernel.cfa

    r986cb99 rc1c95b1  
    118118
    119119extern void __cfa_io_start( processor * );
    120 extern void __cfa_io_drain( processor * );
     120extern bool __cfa_io_drain( processor * );
    121121extern void __cfa_io_flush( processor * );
    122122extern void __cfa_io_stop ( processor * );
    123 static inline void __maybe_io_drain( processor * );
     123static inline bool __maybe_io_drain( processor * );
    124124
    125125extern void __disable_interrupts_hard();
     
    743743#endif
    744744
    745 static inline void __maybe_io_drain( processor * proc ) {
     745static inline bool __maybe_io_drain( processor * proc ) {
    746746        #if defined(CFA_HAVE_LINUX_IO_URING_H)
    747747                __cfadbg_print_safe(runtime_core, "Kernel : core %p checking io for ring %d\n", proc, proc->io.ctx->fd);
     
    751751                unsigned head = *ctx->cq.head;
    752752                unsigned tail = *ctx->cq.tail;
    753                 if(head != tail) __cfa_io_drain( proc );
     753                if(head == tail) return false;
     754                return __cfa_io_drain( proc );
    754755        #endif
    755756}
Note: See TracChangeset for help on using the changeset viewer.