Ignore:
File:
1 edited

Legend:

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

    rc40e7c5 rb69ea6b  
    2121#include <assert.h>
    2222
     23#include "bits/cfatime.h"
     24
    2325struct thread_desc;
    2426struct processor;
    25 
    26 struct timespec;
    27 struct itimerval;
    28 
    29 //=============================================================================================
    30 // time type
    31 //=============================================================================================
    32 
    33 struct __cfa_time_t {
    34         uint64_t val;
    35 };
    36 
    37 // ctors
    38 void ?{}( __cfa_time_t & this );
    39 void ?{}( __cfa_time_t & this, zero_t zero );
    40 void ?{}( __cfa_time_t & this, timespec * curr );
    41 void ?{}( itimerval & this, __cfa_time_t * alarm );
    42 
    43 __cfa_time_t ?=?( __cfa_time_t & this, zero_t rhs );
    44 
    45 // logical ops
    46 static inline bool ?==?( __cfa_time_t lhs, __cfa_time_t rhs ) { return lhs.val == rhs.val; }
    47 static inline bool ?!=?( __cfa_time_t lhs, __cfa_time_t rhs ) { return lhs.val != rhs.val; }
    48 static inline bool ?>? ( __cfa_time_t lhs, __cfa_time_t rhs ) { return lhs.val >  rhs.val; }
    49 static inline bool ?<? ( __cfa_time_t lhs, __cfa_time_t rhs ) { return lhs.val <  rhs.val; }
    50 static inline bool ?>=?( __cfa_time_t lhs, __cfa_time_t rhs ) { return lhs.val >= rhs.val; }
    51 static inline bool ?<=?( __cfa_time_t lhs, __cfa_time_t rhs ) { return lhs.val <= rhs.val; }
    52 
    53 static inline bool ?==?( __cfa_time_t lhs, zero_t rhs ) { return lhs.val == rhs; }
    54 static inline bool ?!=?( __cfa_time_t lhs, zero_t rhs ) { return lhs.val != rhs; }
    55 static inline bool ?>? ( __cfa_time_t lhs, zero_t rhs ) { return lhs.val >  rhs; }
    56 static inline bool ?<? ( __cfa_time_t lhs, zero_t rhs ) { return lhs.val <  rhs; }
    57 static inline bool ?>=?( __cfa_time_t lhs, zero_t rhs ) { return lhs.val >= rhs; }
    58 static inline bool ?<=?( __cfa_time_t lhs, zero_t rhs ) { return lhs.val <= rhs; }
    59 
    60 // addition/substract
    61 static inline __cfa_time_t ?+?( __cfa_time_t lhs, __cfa_time_t rhs ) {
    62         __cfa_time_t ret;
    63         ret.val = lhs.val + rhs.val;
    64         return ret;
    65 }
    66 
    67 static inline __cfa_time_t ?-?( __cfa_time_t lhs, __cfa_time_t rhs ) {
    68         __cfa_time_t ret;
    69         ret.val = lhs.val - rhs.val;
    70         return ret;
    71 }
    72 
    73 __cfa_time_t from_s ( uint64_t );
    74 __cfa_time_t from_ms( uint64_t );
    75 __cfa_time_t from_us( uint64_t );
    76 __cfa_time_t from_ns( uint64_t );
    77 
    78 extern __cfa_time_t zero_time;
    7927
    8028//=============================================================================================
     
    10553typedef alarm_node_t ** __alarm_it_t;
    10654
    107 void ?{}( alarm_node_t & this, thread_desc * thrd, __cfa_time_t alarm = zero_time, __cfa_time_t period = zero_time );
    108 void ?{}( alarm_node_t & this, processor   * proc, __cfa_time_t alarm = zero_time, __cfa_time_t period = zero_time );
     55void ?{}( alarm_node_t & this, thread_desc * thrd, __cfa_time_t alarm = 0`cfa_s, __cfa_time_t period = 0`cfa_s );
     56void ?{}( alarm_node_t & this, processor   * proc, __cfa_time_t alarm = 0`cfa_s, __cfa_time_t period = 0`cfa_s );
    10957void ^?{}( alarm_node_t & this );
    11058
Note: See TracChangeset for help on using the changeset viewer.