Changes in src/libcfa/concurrency/alarm.c [ea7d2b0:6b0b624]
- File:
-
- 1 edited
-
src/libcfa/concurrency/alarm.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/concurrency/alarm.c
rea7d2b0 r6b0b624 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 } … … 186 186 187 187 disable_interrupts(); 188 lock( event_kernel->lock DEBUG_CTX2 );188 lock( &event_kernel->lock DEBUG_CTX2 ); 189 189 { 190 190 verify( validate( alarms ) ); … … 196 196 } 197 197 } 198 unlock( event_kernel->lock );198 unlock( &event_kernel->lock ); 199 199 this->set = true; 200 200 enable_interrupts( DEBUG_CTX ); … … 203 203 void unregister_self( alarm_node_t * this ) { 204 204 disable_interrupts(); 205 lock( event_kernel->lock DEBUG_CTX2 );205 lock( &event_kernel->lock DEBUG_CTX2 ); 206 206 { 207 207 verify( validate( &event_kernel->alarms ) ); 208 208 remove( &event_kernel->alarms, this ); 209 209 } 210 unlock( event_kernel->lock );210 unlock( &event_kernel->lock ); 211 211 enable_interrupts( DEBUG_CTX ); 212 212 this->set = false;
Note:
See TracChangeset
for help on using the changeset viewer.