Changes in src/libcfa/concurrency/alarm.c [82ff5845:c81ebf9]
- File:
-
- 1 edited
-
src/libcfa/concurrency/alarm.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/concurrency/alarm.c
r82ff5845 rc81ebf9 16 16 17 17 extern "C" { 18 #include <errno.h>19 #include <stdio.h>20 #include <string.h>21 18 #include <time.h> 22 #include <unistd.h>23 19 #include <sys/time.h> 24 20 } … … 26 22 #include "alarm.h" 27 23 #include "kernel_private.h" 28 #include "libhdr.h"29 24 #include "preemption.h" 30 25 … … 36 31 timespec curr; 37 32 clock_gettime( CLOCK_REALTIME, &curr ); 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; 33 return ((__cfa_time_t)curr.tv_sec * TIMEGRAN) + curr.tv_nsec; 45 34 } 46 35 47 36 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 55 37 itimerval val; 56 38 val.it_value.tv_sec = alarm / TIMEGRAN; // seconds … … 146 128 lock( &systemProcessor->alarm_lock ); 147 129 { 148 bool first = !systemProcessor->alarms.head;149 150 130 insert( &systemProcessor->alarms, this ); 151 131 if( systemProcessor->pending_alarm ) { 152 132 tick_preemption(); 153 }154 if( first ) {155 __kernel_set_timer( systemProcessor->alarms.head->alarm - __kernel_get_time() );156 133 } 157 134 }
Note:
See TracChangeset
for help on using the changeset viewer.