Changeset 9f5a71eb for libcfa


Ignore:
Timestamp:
Mar 2, 2022, 4:27:39 PM (2 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, ast-experimental, enum, master, pthread-emulation, qualifiedEnum
Children:
496f92ed
Parents:
1860885
Message:

Totally confusing myself in these commit messages.
This file was missing form last commit.

File:
1 edited

Legend:

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

    r1860885 r9f5a71eb  
    408408// I/O Arbiter
    409409//=============================================================================================
    410         static inline void block(__outstanding_io_queue & queue, __outstanding_io & item) {
     410        static inline bool enqueue(__outstanding_io_queue & queue, __outstanding_io & item) {
     411                bool was_empty;
     412
    411413                // Lock the list, it's not thread safe
    412414                lock( queue.lock __cfaabi_dbg_ctx2 );
    413415                {
     416                        was_empty = empty(queue.queue);
     417
    414418                        // Add our request to the list
    415419                        add( queue.queue, item );
     
    420424                unlock( queue.lock );
    421425
    422                 wait( item.sem );
     426                return was_empty;
    423427        }
    424428
     
    438442                pa.want = want;
    439443
    440                 block(this.pending, (__outstanding_io&)pa);
     444                enqueue(this.pending, (__outstanding_io&)pa);
     445
     446                wait( pa.sem );
    441447
    442448                return pa.ctx;
     
    491497                ei.lazy = lazy;
    492498
    493                 block(ctx->ext_sq, (__outstanding_io&)ei);
     499                bool we = enqueue(ctx->ext_sq, (__outstanding_io&)ei);
     500
     501                ctx->proc->io.pending = true;
     502
     503                if( we ) {
     504                        sigval_t value = { PREEMPT_IO };
     505                        pthread_sigqueue(ctx->proc->kernel_thread, SIGUSR1, value);
     506                }
     507
     508                wait( ei.sem );
    494509
    495510                __cfadbg_print_safe(io, "Kernel I/O : %u submitted from arbiter\n", have);
Note: See TracChangeset for help on using the changeset viewer.