Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/kernel.hfa

    rdddb3dd0 rda3963a  
    2828}
    2929
     30//-----------------------------------------------------------------------------
     31// Underlying Locks
    3032#ifdef __CFA_WITH_VERIFY__
    3133        extern bool __cfaabi_dbg_in_kernel();
    3234#endif
    3335
    34 //-----------------------------------------------------------------------------
    35 // I/O
    36 struct cluster;
    37 struct $io_context;
    38 struct $io_arbiter;
    39 
    40 struct io_context_params {
    41         int num_entries;
    42 };
    43 
    44 void  ?{}(io_context_params & this);
     36struct __bin_sem_t {
     37        pthread_mutex_t         lock;
     38        pthread_cond_t          cond;
     39        int                     val;
     40};
    4541
    4642//-----------------------------------------------------------------------------
     
    8278        pthread_t kernel_thread;
    8379
    84         struct {
    85                 $io_context * ctx;
    86                 bool pending;
    87                 bool dirty;
    88         } io;
    89 
    9080        // Preemption data
    9181        // Node which is added in the discrete event simulaiton
     
    9686
    9787        // Idle lock (kernel semaphore)
    98         int idle;
     88        __bin_sem_t idle;
    9989
    10090        // Termination synchronisation (user semaphore)
     
    126116
    127117DLISTED_MGD_IMPL_OUT(processor)
     118
     119//-----------------------------------------------------------------------------
     120// I/O
     121struct __io_data;
     122
     123// IO poller user-thread
     124// Not using the "thread" keyword because we want to control
     125// more carefully when to start/stop it
     126struct $io_ctx_thread {
     127        struct __io_data * ring;
     128        single_sem sem;
     129        volatile bool done;
     130        $thread self;
     131};
     132
     133
     134struct io_context {
     135        $io_ctx_thread thrd;
     136};
     137
     138struct io_context_params {
     139        int num_entries;
     140        int num_ready;
     141        int submit_aff;
     142        bool eager_submits:1;
     143        bool poller_submits:1;
     144        bool poll_submit:1;
     145        bool poll_complete:1;
     146};
     147
     148void  ?{}(io_context_params & this);
     149
     150void  ?{}(io_context & this, struct cluster & cl);
     151void  ?{}(io_context & this, struct cluster & cl, const io_context_params & params);
     152void ^?{}(io_context & this);
     153
     154struct io_cancellation {
     155        __u64 target;
     156};
     157
     158static inline void  ?{}(io_cancellation & this) { this.target = -1u; }
     159static inline void ^?{}(io_cancellation &) {}
     160bool cancel(io_cancellation & this);
    128161
    129162//-----------------------------------------------------------------------------
     
    211244
    212245        struct {
    213                 $io_arbiter * arbiter;
    214                 io_context_params params;
     246                io_context * ctxs;
     247                unsigned cnt;
    215248        } io;
    216249
Note: See TracChangeset for help on using the changeset viewer.