Changeset d9ece1cb in mainline
- Timestamp:
- 2009-12-01T20:08:32Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- d359e227
- Parents:
- d52b82ad
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/proc/thread.h
rd52b82ad rd9ece1cb 263 263 extern unative_t sys_thread_exit(int); 264 264 extern unative_t sys_thread_get_id(thread_id_t *); 265 extern unative_t sys_thread_usleep(uint32_t); 265 266 266 267 #endif -
kernel/generic/include/syscall/syscall.h
rd52b82ad rd9ece1cb 43 43 SYS_THREAD_EXIT, 44 44 SYS_THREAD_GET_ID, 45 SYS_THREAD_USLEEP, 45 46 46 47 SYS_TASK_GET_ID, -
kernel/generic/src/proc/thread.c
rd52b82ad rd9ece1cb 812 812 } 813 813 814 /** Syscall wrapper for sleeping. */ 815 unative_t sys_thread_usleep(uint32_t usec) 816 { 817 thread_usleep(usec); 818 return 0; 819 } 820 814 821 /** @} 815 822 */ -
kernel/generic/src/syscall/syscall.c
rd52b82ad rd9ece1cb 111 111 (syshandler_t) sys_thread_exit, 112 112 (syshandler_t) sys_thread_get_id, 113 (syshandler_t) sys_thread_usleep, 113 114 114 115 (syshandler_t) sys_task_get_id, -
uspace/lib/libc/generic/time.c
rd52b82ad rd9ece1cb 40 40 #include <unistd.h> 41 41 #include <atomic.h> 42 #include <futex.h>43 42 #include <sysinfo.h> 44 43 #include <ipc/services.h> 44 #include <libc.h> 45 45 46 46 #include <sysinfo.h> … … 191 191 int usleep(unsigned long usec) 192 192 { 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); 197 194 return 0; 198 195 } … … 201 198 unsigned int sleep(unsigned int seconds) 202 199 { 203 atomic_t futex = FUTEX_INITIALIZER;204 205 futex_initialize(&futex, 0);206 207 200 /* Sleep in 1000 second steps to support 208 201 full argument range */ … … 210 203 unsigned int period = (seconds > 1000) ? 1000 : seconds; 211 204 212 futex_down_timeout(&futex, period * 1000000,0);205 usleep(period * 1000000); 213 206 seconds -= period; 214 207 }
Note:
See TracChangeset
for help on using the changeset viewer.