Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/libc/generic/time.c

    rd9ece1cb rc61d34b  
    4040#include <unistd.h>
    4141#include <atomic.h>
     42#include <futex.h>
    4243#include <sysinfo.h>
    4344#include <ipc/services.h>
    44 #include <libc.h>
    4545
    4646#include <sysinfo.h>
     
    191191int usleep(unsigned long usec)
    192192{
    193         (void) __SYSCALL1(SYS_THREAD_USLEEP, usec);     
     193        atomic_t futex = FUTEX_INITIALIZER;
     194
     195        futex_initialize(&futex, 0);
     196        futex_down_timeout(&futex, usec, 0);
    194197        return 0;
    195198}
     
    198201unsigned int sleep(unsigned int seconds)
    199202{
     203        atomic_t futex = FUTEX_INITIALIZER;
     204
     205        futex_initialize(&futex, 0);
     206       
    200207        /* Sleep in 1000 second steps to support
    201208           full argument range */
     
    203210                unsigned int period = (seconds > 1000) ? 1000 : seconds;
    204211       
    205                 usleep(period * 1000000);
     212                futex_down_timeout(&futex, period * 1000000, 0);
    206213                seconds -= period;
    207214        }
Note: See TracChangeset for help on using the changeset viewer.