Changeset dd655970 in mainline for uspace/libc/generic/time.c


Ignore:
Timestamp:
2007-04-06T14:01:46Z (18 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
69e9dd2
Parents:
3ce7f082
Message:

new user space testing framework (unfinished)

File:
1 edited

Legend:

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

    r3ce7f082 rdd655970  
    109109}
    110110
    111 /** Wait unconditionally for specified microseconds */
     111/** Wait unconditionally for specified number of microseconds */
    112112void usleep(unsigned long usec)
    113113{
    114114        atomic_t futex = FUTEX_INITIALIZER;
    115115
    116         futex_initialize(&futex,0);
     116        futex_initialize(&futex, 0);
    117117        futex_down_timeout(&futex, usec, 0);
     118}
     119
     120/** Wait unconditionally for specified number of seconds */
     121unsigned int sleep(unsigned int seconds)
     122{
     123        atomic_t futex = FUTEX_INITIALIZER;
     124
     125        futex_initialize(&futex, 0);
     126       
     127        /* Sleep in 1000 second steps to support
     128           full argument range */
     129        while (seconds > 0) {
     130                unsigned int period = (seconds > 1000) ? 1000 : seconds;
     131       
     132                futex_down_timeout(&futex, period * 1000000, 0);
     133                seconds -= period;
     134        }
    118135}
    119136
Note: See TracChangeset for help on using the changeset viewer.