Ignore:
Timestamp:
Jan 7, 2021, 3:27:00 PM (5 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:
2b4daf2, 64aeca0
Parents:
3c64c668 (diff), eef8dfb (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' into park_unpark

File:
1 edited

Legend:

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

    r3c64c668 r58fe85a  
    2323#include "time.hfa"
    2424
     25#include "containers/list.hfa"
     26
    2527struct $thread;
    2628struct processor;
     
    3739//=============================================================================================
    3840
     41enum alarm_type{ Kernel = 0, User = 1, Callback = 2 };
     42
     43struct alarm_node_t;
     44
     45typedef void (*Alarm_Callback)(alarm_node_t & );
     46
    3947struct alarm_node_t {
    4048        Time alarm;                             // time when alarm goes off
    4149        Duration period;                        // if > 0 => period of alarm
    42         alarm_node_t * next;            // intrusive link list field
     50
     51        DLISTED_MGD_IMPL_IN(alarm_node_t)
    4352
    4453        union {
    45                 $thread * thrd; // thrd who created event
    46                 processor * proc;               // proc who created event
     54                $thread * thrd;                                 // thrd who created event
     55                processor * proc;                               // proc who created event
     56                Alarm_Callback callback;                // callback to handle event
    4757        };
    4858
    4959        bool set                :1;             // whether or not the alarm has be registered
    50         bool kernel_alarm       :1;             // true if this is not a user defined alarm
     60        enum alarm_type type;           // true if this is not a user defined alarm
    5161};
    52 
    53 typedef alarm_node_t ** __alarm_it_t;
     62DLISTED_MGD_IMPL_OUT(alarm_node_t)
    5463
    5564void ?{}( alarm_node_t & this, $thread * thrd, Time alarm, Duration period );
    5665void ?{}( alarm_node_t & this, processor   * proc, Time alarm, Duration period );
     66void ?{}( alarm_node_t & this, Alarm_Callback callback, Time alarm, Duration period );
    5767void ^?{}( alarm_node_t & this );
    5868
    59 struct alarm_list_t {
    60         alarm_node_t * head;
    61         __alarm_it_t tail;
    62 };
    63 
    64 static inline void ?{}( alarm_list_t & this ) with( this ) {
    65         head = 0;
    66         tail = &head;
    67 }
     69typedef dlist(alarm_node_t, alarm_node_t) alarm_list_t;
    6870
    6971void insert( alarm_list_t * this, alarm_node_t * n );
Note: See TracChangeset for help on using the changeset viewer.