Changeset 537 for Whitix/branches/hybrid

Show
Ignore:
Timestamp:
05/24/08 09:54:33 (3 months ago)
Author:
mwhitworth
Message:

Simplify timer code.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • Whitix/branches/hybrid/kernel/timer.c

    r9 r537  
    2020#include <llist.h> 
    2121#include <console.h> 
     22#include <module.h> 
    2223#include <error.h> 
    2324#include <task.h> 
     
    7374} 
    7475 
     76SYMBOL_EXPORT(TimerAdd); 
     77 
    7578/*********************************************************************** 
    7679 * 
     
    110113        return err; 
    111114} 
     115 
     116SYMBOL_EXPORT(TimerRemove); 
    112117 
    113118/*********************************************************************** 
     
    151156void Sleep(int milliSeconds) 
    152157{ 
    153         struct Timer* timer=(struct Timer*)malloc(sizeof(struct Timer)); 
     158        struct Timer timer; 
    154159 
    155         timer->func=SleepWakeup; 
    156         timer->expires=milliSeconds; 
    157         timer->data=currThread; 
     160        timer.func=SleepWakeup; 
     161        timer.expires=milliSeconds; 
     162        timer.data=currThread; 
    158163 
    159         TimerAdd(timer); 
     164        TimerAdd(&timer); 
    160165        ThrSuspendThread(currThread); 
    161166        ThrSchedule(); 
     167} 
    162168 
    163         /* And will arrive here after it expires */ 
    164         free(timer); 
    165 } 
     169SYMBOL_EXPORT(Sleep);