Ignore:
Timestamp:
Mar 17, 2021, 4:52:22 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:
5c2b454
Parents:
c407434e
Message:

Fix io to no longer use monitors since some usages aren't in threads

Location:
libcfa/src/concurrency/io
Files:
2 edited

Legend:

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

    rc407434e r11054eb  
    110110                this.arbiter = cl.io.arbiter;
    111111                this.ext_sq.empty = true;
    112                 (this.ext_sq.blocked){};
     112                (this.ext_sq.queue){};
    113113                __io_uring_setup( this, cl.io.params, proc->idle );
    114114                __cfadbg_print_safe(io_core, "Kernel I/O : Created ring for io_context %u (%p)\n", this.fd, &this);
     
    329329//=============================================================================================
    330330        void ?{}( $io_arbiter & this ) {
    331                 this.pending.flag = false;
    332         }
    333 
    334         void ^?{}( $io_arbiter & mutex this ) {
    335                 // /* paranoid */ verify( empty(this.assigned) );
    336                 // /* paranoid */ verify( empty(this.available) );
    337                 /* paranoid */ verify( is_empty(this.pending.blocked) );
    338         }
     331                this.pending.empty = true;
     332        }
     333
     334        void ^?{}( $io_arbiter & this ) {}
    339335
    340336        $io_arbiter * create(void) {
  • libcfa/src/concurrency/io/types.hfa

    rc407434e r11054eb  
    2222
    2323#include "bits/locks.hfa"
     24#include "bits/queue.hfa"
    2425#include "kernel/fwd.hfa"
    2526
     
    9596        };
    9697
     98        struct __outstanding_io {
     99                inline Colable;
     100                single_sem sem;
     101        };
     102        static inline __outstanding_io *& Next( __outstanding_io * n ) { return (__outstanding_io *)Next( (Colable *)n ); }
     103
     104        struct __outstanding_io_queue {
     105                __spinlock_t lock;
     106                Queue(__outstanding_io) queue;
     107                volatile bool empty;
     108        };
     109
     110        struct __external_io {
     111                inline __outstanding_io;
     112                __u32 * idxs;
     113                __u32 have;
     114                bool lazy;
     115        };
     116
     117
    97118        struct __attribute__((aligned(128))) $io_context {
    98119                $io_arbiter * arbiter;
    99120                processor * proc;
    100121
    101                 struct {
    102                         volatile bool empty;
    103                         condition blocked;
    104                 } ext_sq;
     122                __outstanding_io_queue ext_sq;
    105123
    106124                struct __sub_ring_t sq;
     
    110128        };
    111129
    112         monitor __attribute__((aligned(128))) $io_arbiter {
    113                 struct {
    114                         condition blocked;
    115                         $io_context * ctx;
    116                         volatile bool flag;
    117                 } pending;
     130        struct __pending_alloc {
     131                inline __outstanding_io;
     132                __u32 * idxs;
     133                __u32 want;
     134                $io_context * ctx;
     135        };
     136
     137        struct __attribute__((aligned(128))) $io_arbiter {
     138                __outstanding_io_queue pending;
    118139        };
    119140
Note: See TracChangeset for help on using the changeset viewer.