Changeset 4e74466


Ignore:
Timestamp:
May 5, 2020, 12:12:47 PM (17 months ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
arm-eh, jacob/cs343-translation, master, new-ast, new-ast-unique-expr
Children:
71c8b7e
Parents:
b6f2b21
Message:

Fast poller thread now polls a few times before baton-passing to the slow thread.
Currently doing 5 tries, the number is arbitrary and requires more work.

File:
1 edited

Legend:

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

    rb6f2b21 r4e74466  
    522522                __cfadbg_print_safe(io_core, "Kernel I/O : Fast poller for ring %p ready\n", &this.ring);
    523523
     524                int reset = 0;
     525
    524526                // Then loop until we need to start
    525527                while(!__atomic_load_n(&this.ring->done, __ATOMIC_SEQ_CST)) {
     
    527529                        this.waiting = false;
    528530                        int count = __drain_io( *this.ring, 0p, 0, false );
     531                        reset += count > 0 ? 1 : 0;
    529532
    530533                        // Update statistics
     
    535538
    536539                        this.waiting = true;
    537                         if(0 > count) {
     540                        if(reset < 5) {
    538541                                // If we got something, just yield and check again
    539542                                yield();
     
    544547                                post( this.ring->poller.sem );
    545548                                park( __cfaabi_dbg_ctx );
     549                                reset = 0;
    546550                        }
    547551                }
Note: See TracChangeset for help on using the changeset viewer.