Ignore:
File:
1 edited

Legend:

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

    r4aeaee5 r58b6d1b  
    2323#include "time.hfa"
    2424
    25 #include "containers/list.hfa"
    26 
    27 struct $thread;
     25struct thread_desc;
    2826struct processor;
    2927
     
    3937//=============================================================================================
    4038
    41 enum alarm_type{ Kernel = 0, User = 1, Callback = 2 };
    42 
    43 struct alarm_node_t;
    44 
    45 typedef void (*Alarm_Callback)(alarm_node_t & );
    46 
    4739struct alarm_node_t {
    4840        Time alarm;                             // time when alarm goes off
    4941        Duration period;                        // if > 0 => period of alarm
    50 
    51         DLISTED_MGD_IMPL_IN(alarm_node_t)
     42        alarm_node_t * next;            // intrusive link list field
    5243
    5344        union {
    54                 $thread * thrd;                                 // thrd who created event
    55                 processor * proc;                               // proc who created event
    56                 Alarm_Callback callback;                // callback to handle event
     45                thread_desc * thrd;     // thrd who created event
     46                processor * proc;               // proc who created event
    5747        };
    5848
    5949        bool set                :1;             // whether or not the alarm has be registered
    60         enum alarm_type type;           // true if this is not a user defined alarm
     50        bool kernel_alarm       :1;             // true if this is not a user defined alarm
    6151};
    62 DLISTED_MGD_IMPL_OUT(alarm_node_t)
    6352
    64 void ?{}( alarm_node_t & this, $thread * thrd, Time alarm, Duration period );
     53typedef alarm_node_t ** __alarm_it_t;
     54
     55void ?{}( alarm_node_t & this, thread_desc * thrd, Time alarm, Duration period );
    6556void ?{}( alarm_node_t & this, processor   * proc, Time alarm, Duration period );
    66 void ?{}( alarm_node_t & this, Alarm_Callback callback, Time alarm, Duration period );
    6757void ^?{}( alarm_node_t & this );
    6858
    69 typedef dlist(alarm_node_t, alarm_node_t) alarm_list_t;
     59struct alarm_list_t {
     60        alarm_node_t * head;
     61        __alarm_it_t tail;
     62};
     63
     64static inline void ?{}( alarm_list_t & this ) with( this ) {
     65        head = 0;
     66        tail = &head;
     67}
    7068
    7169void insert( alarm_list_t * this, alarm_node_t * n );
Note: See TracChangeset for help on using the changeset viewer.