Changes in src/libcfa/concurrency/alarm.c [c81ebf9:82ff5845]
- File:
-
- 1 edited
-
src/libcfa/concurrency/alarm.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/concurrency/alarm.c
rc81ebf9 r82ff5845 16 16 17 17 extern "C" { 18 #include <errno.h> 19 #include <stdio.h> 20 #include <string.h> 18 21 #include <time.h> 22 #include <unistd.h> 19 23 #include <sys/time.h> 20 24 } … … 22 26 #include "alarm.h" 23 27 #include "kernel_private.h" 28 #include "libhdr.h" 24 29 #include "preemption.h" 25 30 … … 31 36 timespec curr; 32 37 clock_gettime( CLOCK_REALTIME, &curr ); 33 return ((__cfa_time_t)curr.tv_sec * TIMEGRAN) + curr.tv_nsec; 38 __cfa_time_t curr_time = ((__cfa_time_t)curr.tv_sec * TIMEGRAN) + curr.tv_nsec; 39 LIB_DEBUG_DO( 40 char text[256]; 41 __attribute__((unused)) int len = snprintf( text, 256, "Kernel : current time is %lu\n", curr_time ); 42 LIB_DEBUG_WRITE( STDERR_FILENO, text, len ); 43 ); 44 return curr_time; 34 45 } 35 46 36 47 void __kernel_set_timer( __cfa_time_t alarm ) { 48 49 LIB_DEBUG_DO( 50 char text[256]; 51 __attribute__((unused)) int len = snprintf( text, 256, "Kernel : set timer to %lu\n", (__cfa_time_t)alarm ); 52 LIB_DEBUG_WRITE( STDERR_FILENO, text, len ); 53 ); 54 37 55 itimerval val; 38 56 val.it_value.tv_sec = alarm / TIMEGRAN; // seconds … … 128 146 lock( &systemProcessor->alarm_lock ); 129 147 { 148 bool first = !systemProcessor->alarms.head; 149 130 150 insert( &systemProcessor->alarms, this ); 131 151 if( systemProcessor->pending_alarm ) { 132 152 tick_preemption(); 153 } 154 if( first ) { 155 __kernel_set_timer( systemProcessor->alarms.head->alarm - __kernel_get_time() ); 133 156 } 134 157 }
Note:
See TracChangeset
for help on using the changeset viewer.