Rev 2615 | Rev 2677 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 2615 | Rev 2616 | ||
|---|---|---|---|
| Line 185... | Line 185... | ||
| 185 | *tloc = tv.tv_sec; |
185 | *tloc = tv.tv_sec; |
| 186 | return tv.tv_sec; |
186 | return tv.tv_sec; |
| 187 | } |
187 | } |
| 188 | 188 | ||
| 189 | /** Wait unconditionally for specified number of microseconds */ |
189 | /** Wait unconditionally for specified number of microseconds */ |
| 190 | void usleep(unsigned long usec) |
190 | int usleep(unsigned long usec) |
| 191 | { |
191 | { |
| 192 | atomic_t futex = FUTEX_INITIALIZER; |
192 | atomic_t futex = FUTEX_INITIALIZER; |
| 193 | 193 | ||
| 194 | futex_initialize(&futex, 0); |
194 | futex_initialize(&futex, 0); |
| 195 | futex_down_timeout(&futex, usec, 0); |
195 | futex_down_timeout(&futex, usec, 0); |
| - | 196 | return 0; |
|
| 196 | } |
197 | } |
| 197 | 198 | ||
| 198 | /** Wait unconditionally for specified number of seconds */ |
199 | /** Wait unconditionally for specified number of seconds */ |
| 199 | unsigned int sleep(unsigned int seconds) |
200 | unsigned int sleep(unsigned int seconds) |
| 200 | { |
201 | { |
| Line 208... | Line 209... | ||
| 208 | unsigned int period = (seconds > 1000) ? 1000 : seconds; |
209 | unsigned int period = (seconds > 1000) ? 1000 : seconds; |
| 209 | 210 | ||
| 210 | futex_down_timeout(&futex, period * 1000000, 0); |
211 | futex_down_timeout(&futex, period * 1000000, 0); |
| 211 | seconds -= period; |
212 | seconds -= period; |
| 212 | } |
213 | } |
| - | 214 | return 0; |
|
| 213 | } |
215 | } |
| 214 | 216 | ||
| 215 | /** @} |
217 | /** @} |
| 216 | */ |
218 | */ |