Changes in uspace/lib/c/generic/thread/fibril.c [205f1add:f787c8e] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/thread/fibril.c
r205f1add rf787c8e 60 60 typedef struct { 61 61 link_t link; 62 struct time specexpires;62 struct timeval expires; 63 63 fibril_event_t *event; 64 64 } _timeout_t; … … 142 142 } 143 143 144 static inline errno_t _ready_down(const struct time spec*expires)144 static inline errno_t _ready_down(const struct timeval *expires) 145 145 { 146 146 if (multithreaded) … … 253 253 } 254 254 255 static errno_t _ipc_wait(ipc_call_t *call, const struct time spec*expires)255 static errno_t _ipc_wait(ipc_call_t *call, const struct timeval *expires) 256 256 { 257 257 if (!expires) … … 261 261 return ipc_wait(call, SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NON_BLOCKING); 262 262 263 struct time specnow;263 struct timeval now; 264 264 getuptime(&now); 265 265 266 if (t s_gteq(&now, expires))266 if (tv_gteq(&now, expires)) 267 267 return ipc_wait(call, SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NON_BLOCKING); 268 268 269 return ipc_wait(call, NSEC2USEC(ts_sub_diff(expires, &now)), 270 SYNCH_FLAGS_NONE); 269 return ipc_wait(call, tv_sub_diff(expires, &now), SYNCH_FLAGS_NONE); 271 270 } 272 271 … … 276 275 * wait after new ready fibrils are added. 277 276 */ 278 static fibril_t *_ready_list_pop(const struct time spec*expires, bool locked)277 static fibril_t *_ready_list_pop(const struct timeval *expires, bool locked) 279 278 { 280 279 if (locked) { … … 371 370 static fibril_t *_ready_list_pop_nonblocking(bool locked) 372 371 { 373 struct time spec tv = { .tv_sec = 0, .tv_nsec = 0 };372 struct timeval tv = { .tv_sec = 0, .tv_usec = 0 }; 374 373 return _ready_list_pop(&tv, locked); 375 374 } … … 394 393 395 394 /* Blocks the current fibril until an IPC call arrives. */ 396 static errno_t _wait_ipc(ipc_call_t *call, const struct time spec*expires)395 static errno_t _wait_ipc(ipc_call_t *call, const struct timeval *expires) 397 396 { 398 397 futex_assert_is_not_locked(&fibril_futex); … … 431 430 432 431 /** Fire all timeouts that expired. */ 433 static struct time spec *_handle_expired_timeouts(struct timespec*next_timeout)434 { 435 struct time spec ts;436 getuptime(&t s);432 static struct timeval *_handle_expired_timeouts(struct timeval *next_timeout) 433 { 434 struct timeval tv; 435 getuptime(&tv); 437 436 438 437 futex_lock(&fibril_futex); … … 442 441 _timeout_t *to = list_get_instance(cur, _timeout_t, link); 443 442 444 if (t s_gt(&to->expires, &ts)) {443 if (tv_gt(&to->expires, &tv)) { 445 444 *next_timeout = to->expires; 446 445 futex_unlock(&fibril_futex); … … 536 535 (void) arg; 537 536 538 struct time specnext_timeout;537 struct timeval next_timeout; 539 538 while (true) { 540 struct time spec*to = _handle_expired_timeouts(&next_timeout);539 struct timeval *to = _handle_expired_timeouts(&next_timeout); 541 540 fibril_t *f = _ready_list_pop(to, false); 542 541 if (f) { … … 616 615 _timeout_t *cur = list_get_instance(tmp, _timeout_t, link); 617 616 618 if (t s_gteq(&cur->expires, &timeout->expires))617 if (tv_gteq(&cur->expires, &timeout->expires)) 619 618 break; 620 619 … … 635 634 * @return ETIMEOUT if timed out. EOK otherwise. 636 635 */ 637 errno_t fibril_wait_timeout(fibril_event_t *event, 638 const struct timespec *expires) 636 errno_t fibril_wait_timeout(fibril_event_t *event, const struct timeval *expires) 639 637 { 640 638 assert(fibril_self()->rmutex_locks == 0); … … 891 889 } 892 890 893 void fibril_usleep( usec_t timeout)894 { 895 struct time specexpires;891 void fibril_usleep(suseconds_t timeout) 892 { 893 struct timeval expires; 896 894 getuptime(&expires); 897 t s_add_diff(&expires, USEC2NSEC(timeout));895 tv_add_diff(&expires, timeout); 898 896 899 897 fibril_event_t event = FIBRIL_EVENT_INIT; … … 901 899 } 902 900 903 void fibril_sleep( sec_t sec)904 { 905 struct time specexpires;901 void fibril_sleep(unsigned int sec) 902 { 903 struct timeval expires; 906 904 getuptime(&expires); 907 905 expires.tv_sec += sec; … … 918 916 } 919 917 920 errno_t fibril_ipc_wait(ipc_call_t *call, const struct time spec*expires)918 errno_t fibril_ipc_wait(ipc_call_t *call, const struct timeval *expires) 921 919 { 922 920 return _wait_ipc(call, expires);
Note:
See TracChangeset
for help on using the changeset viewer.