Changeset 6b224a52 for src/libcfa/concurrency/alarm.c
- Timestamp:
- Aug 25, 2017, 12:11:53 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:
- bf7b9da7
- Parents:
- 135b431 (diff), f676b84 (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.c
r135b431 r6b224a52 40 40 __cfa_time_t zero_time = { 0 }; 41 41 42 void ?{}( __cfa_time_t * this ) { this->val = 0; }43 void ?{}( __cfa_time_t * this, zero_t zero ) { this->val = 0; }44 45 void ?{}( itimerval *this, __cfa_time_t * alarm ) {46 this ->it_value.tv_sec = alarm->val / one_second; // seconds47 this ->it_value.tv_usec = max( (alarm->val % one_second) / one_microsecond, 1000 ); // microseconds48 this ->it_interval.tv_sec = 0;49 this ->it_interval.tv_usec = 0;50 } 51 52 53 void ?{}( __cfa_time_t *this, timespec * curr ) {42 void ?{}( __cfa_time_t & this ) { this.val = 0; } 43 void ?{}( __cfa_time_t & this, zero_t zero ) { this.val = 0; } 44 45 void ?{}( itimerval & this, __cfa_time_t * alarm ) { 46 this.it_value.tv_sec = alarm->val / one_second; // seconds 47 this.it_value.tv_usec = max( (alarm->val % one_second) / one_microsecond, 1000 ); // microseconds 48 this.it_interval.tv_sec = 0; 49 this.it_interval.tv_usec = 0; 50 } 51 52 53 void ?{}( __cfa_time_t & this, timespec * curr ) { 54 54 uint64_t secs = curr->tv_sec; 55 55 uint64_t nsecs = curr->tv_nsec; 56 this ->val = (secs * one_second) + nsecs;57 } 58 59 __cfa_time_t ?=?( __cfa_time_t *this, zero_t rhs ) {60 this ->val = 0;61 return *this;56 this.val = (secs * one_second) + nsecs; 57 } 58 59 __cfa_time_t ?=?( __cfa_time_t & this, zero_t rhs ) { 60 this.val = 0; 61 return this; 62 62 } 63 63 … … 86 86 //============================================================================================= 87 87 88 void ?{}( alarm_node_t *this, thread_desc * thrd, __cfa_time_t alarm = zero_time, __cfa_time_t period = zero_time ) {89 this ->thrd = thrd;90 this ->alarm = alarm;91 this ->period = period;92 this ->next = 0;93 this ->set = false;94 this ->kernel_alarm = false;95 } 96 97 void ?{}( alarm_node_t *this, processor * proc, __cfa_time_t alarm = zero_time, __cfa_time_t period = zero_time ) {98 this ->proc = proc;99 this ->alarm = alarm;100 this ->period = period;101 this ->next = 0;102 this ->set = false;103 this ->kernel_alarm = true;104 } 105 106 void ^?{}( alarm_node_t *this ) {107 if( this ->set ) {108 unregister_self( this );88 void ?{}( alarm_node_t & this, thread_desc * thrd, __cfa_time_t alarm = zero_time, __cfa_time_t period = zero_time ) { 89 this.thrd = thrd; 90 this.alarm = alarm; 91 this.period = period; 92 this.next = 0; 93 this.set = false; 94 this.kernel_alarm = false; 95 } 96 97 void ?{}( alarm_node_t & this, processor * proc, __cfa_time_t alarm = zero_time, __cfa_time_t period = zero_time ) { 98 this.proc = proc; 99 this.alarm = alarm; 100 this.period = period; 101 this.next = 0; 102 this.set = false; 103 this.kernel_alarm = true; 104 } 105 106 void ^?{}( alarm_node_t & this ) { 107 if( this.set ) { 108 unregister_self( &this ); 109 109 } 110 110 }
Note:
See TracChangeset
for help on using the changeset viewer.