Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/concurrency/alarm.c

    r82ff5845 rc81ebf9  
    1616
    1717extern "C" {
    18 #include <errno.h>
    19 #include <stdio.h>
    20 #include <string.h>
    2118#include <time.h>
    22 #include <unistd.h>
    2319#include <sys/time.h>
    2420}
     
    2622#include "alarm.h"
    2723#include "kernel_private.h"
    28 #include "libhdr.h"
    2924#include "preemption.h"
    3025
     
    3631        timespec curr;
    3732        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;
    4534}
    4635
    4736void __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 
    5537        itimerval val;
    5638        val.it_value.tv_sec = alarm / TIMEGRAN;                 // seconds
     
    146128        lock( &systemProcessor->alarm_lock );
    147129        {
    148                 bool first = !systemProcessor->alarms.head;
    149 
    150130                insert( &systemProcessor->alarms, this );
    151131                if( systemProcessor->pending_alarm ) {
    152132                        tick_preemption();
    153                 }
    154                 if( first ) {
    155                         __kernel_set_timer( systemProcessor->alarms.head->alarm - __kernel_get_time() );
    156133                }
    157134        }
Note: See TracChangeset for help on using the changeset viewer.