Changeset 84b14e2 in mainline for uspace/lib/libc/generic/time.c


Ignore:
Timestamp:
2009-12-02T23:33:48Z (14 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
4924675
Parents:
089d746 (diff), 8d04f709 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge simplified futexes (ticket #154) and fix for arm32 kernel atomic
operations (ticket #153).

File:
1 edited

Legend:

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

    r089d746 r84b14e2  
    4040#include <unistd.h>
    4141#include <atomic.h>
    42 #include <futex.h>
    4342#include <sysinfo.h>
    4443#include <ipc/services.h>
     44#include <libc.h>
    4545
    4646#include <sysinfo.h>
     
    191191int usleep(unsigned long usec)
    192192{
    193         atomic_t futex = FUTEX_INITIALIZER;
    194 
    195         futex_initialize(&futex, 0);
    196         futex_down_timeout(&futex, usec, 0);
     193        (void) __SYSCALL1(SYS_THREAD_USLEEP, usec);     
    197194        return 0;
    198195}
     
    201198unsigned int sleep(unsigned int seconds)
    202199{
    203         atomic_t futex = FUTEX_INITIALIZER;
    204 
    205         futex_initialize(&futex, 0);
    206        
    207200        /* Sleep in 1000 second steps to support
    208201           full argument range */
     
    210203                unsigned int period = (seconds > 1000) ? 1000 : seconds;
    211204       
    212                 futex_down_timeout(&futex, period * 1000000, 0);
     205                usleep(period * 1000000);
    213206                seconds -= period;
    214207        }
Note: See TracChangeset for help on using the changeset viewer.