Changeset dd655970 in mainline for uspace/libc/generic/time.c
- Timestamp:
- 2007-04-06T14:01:46Z (18 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 69e9dd2
- Parents:
- 3ce7f082
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/libc/generic/time.c
r3ce7f082 rdd655970 109 109 } 110 110 111 /** Wait unconditionally for specified microseconds */111 /** Wait unconditionally for specified number of microseconds */ 112 112 void usleep(unsigned long usec) 113 113 { 114 114 atomic_t futex = FUTEX_INITIALIZER; 115 115 116 futex_initialize(&futex, 0);116 futex_initialize(&futex, 0); 117 117 futex_down_timeout(&futex, usec, 0); 118 } 119 120 /** Wait unconditionally for specified number of seconds */ 121 unsigned 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 } 118 135 } 119 136
Note:
See TracChangeset
for help on using the changeset viewer.