Changeset 33218c6 for src/libcfa/concurrency/alarm.h
- Timestamp:
- Jul 26, 2017, 12:19:41 PM (8 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- b947fb2
- Parents:
- e0a653d (diff), ea91c42 (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/concurrency/alarm.h
re0a653d r33218c6 1 // -*- Mode: CFA -*-2 1 // 3 2 // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo … … 10 9 // Author : Thierry Delisle 11 10 // Created On : Fri Jun 2 11:31:25 2017 12 // Last Modified By : Thierry Delisle13 // Last Modified On : --14 // Update Count : 011 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:59:27 2017 13 // Update Count : 3 15 14 // 16 15 17 #ifndef ALARM_H 18 #define ALARM_H 16 #pragma once 19 17 20 18 #include <stdbool.h> 19 #include <stdint.h> 21 20 22 #include "assert" 23 24 typedef unsigned long int __cfa_time_t; 21 #include <assert.h> 25 22 26 23 struct thread_desc; 27 24 struct processor; 28 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; 79 29 80 //============================================================================================= 30 81 // Clock logic 31 82 //============================================================================================= 32 33 #define TIMEGRAN 1_000_000_000L // nanosecond granularity, except for timeval34 83 35 84 __cfa_time_t __kernel_get_time(); … … 56 105 typedef alarm_node_t ** __alarm_it_t; 57 106 58 void ?{}( alarm_node_t * this, thread_desc * thrd, __cfa_time_t alarm = 0, __cfa_time_t period = 0);59 void ?{}( alarm_node_t * this, processor * proc, __cfa_time_t alarm = 0, __cfa_time_t period = 0);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 ); 60 109 void ^?{}( alarm_node_t * this ); 61 110 … … 76 125 void unregister_self( alarm_node_t * this ); 77 126 78 #endif79 80 127 // Local Variables: // 81 // mode: CFA//128 // mode: c // 82 129 // tab-width: 6 // 83 130 // End: //
Note:
See TracChangeset
for help on using the changeset viewer.