Changeset 2a84d06d for src/libcfa/concurrency/preemption.c
- Timestamp:
- Mar 27, 2018, 5:22:58 PM (7 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, with_gc
- Children:
- 43725bd
- Parents:
- af1ed1ad
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/concurrency/preemption.c
raf1ed1ad r2a84d06d 10 10 // Created On : Mon Jun 5 14:20:42 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Feb 9 16:38:13201813 // Update Count : 1412 // Last Modified On : Tue Mar 27 11:28:51 2018 13 // Update Count : 24 14 14 // 15 15 … … 27 27 28 28 #if !defined(__CFA_DEFAULT_PREEMPTION__) 29 #define __CFA_DEFAULT_PREEMPTION__ 10` cfa_ms29 #define __CFA_DEFAULT_PREEMPTION__ 10`ms 30 30 #endif 31 31 32 __cfa_time_tdefault_preemption() __attribute__((weak)) {32 Duration default_preemption() __attribute__((weak)) { 33 33 return __CFA_DEFAULT_PREEMPTION__; 34 34 } … … 78 78 79 79 // Get next expired node 80 static inline alarm_node_t * get_expired( alarm_list_t * alarms, __cfa_time_tcurrtime ) {80 static inline alarm_node_t * get_expired( alarm_list_t * alarms, Time currtime ) { 81 81 if( !alarms->head ) return NULL; // If no alarms return null 82 82 if( alarms->head->alarm >= currtime ) return NULL; // If alarms head not expired return null … … 88 88 alarm_node_t * node = NULL; // Used in the while loop but cannot be declared in the while condition 89 89 alarm_list_t * alarms = &event_kernel->alarms; // Local copy for ease of reading 90 __cfa_time_t currtime = __kernel_get_time();// Check current time once so we everything "happens at once"90 Time currtime = __kernel_get_time(); // Check current time once so we everything "happens at once" 91 91 92 92 //Loop throught every thing expired … … 102 102 103 103 // Check if this is a periodic alarm 104 __cfa_time_tperiod = node->period;104 Duration period = node->period; 105 105 if( period > 0 ) { 106 106 node->alarm = currtime + period; // Alarm is periodic, add currtime to it (used cached current time) … … 117 117 118 118 // Update the preemption of a processor and notify interested parties 119 void update_preemption( processor * this, __cfa_time_tduration ) {119 void update_preemption( processor * this, Duration duration ) { 120 120 alarm_node_t * alarm = this->preemption_alarm; 121 121 122 122 // Alarms need to be enabled 123 if ( duration > 0 && ! alarm->set ) {123 if ( duration > 0 && ! alarm->set ) { 124 124 alarm->alarm = __kernel_get_time() + duration; 125 125 alarm->period = duration; … … 291 291 // Used by thread to control when they want to receive preemption signals 292 292 void ?{}( preemption_scope & this, processor * proc ) { 293 (this.alarm){ proc, 0`cfa_s, 0`cfa_s };293 (this.alarm){ proc, (Time){ 0 }, 0`s }; 294 294 this.proc = proc; 295 295 this.proc->preemption_alarm = &this.alarm; … … 301 301 disable_interrupts(); 302 302 303 update_preemption( this.proc, 0` cfa_s );303 update_preemption( this.proc, 0`s ); 304 304 } 305 305
Note: See TracChangeset
for help on using the changeset viewer.