MCPcopy Create free account
hub / github.com/alibaba/PhotonLibOS / thread_usleep

Function thread_usleep

thread/thread.cpp:1366–1376  ·  view source on GitHub ↗

returns 0 if slept well (at lease `useconds`), -1 otherwise

Source from the content-addressed store, hash-verified

1364 }
1365 // returns 0 if slept well (at lease `useconds`), -1 otherwise
1366 static int thread_usleep(Timeout timeout, thread_list* waitq)
1367 {
1368 if (unlikely(timeout.expired())) {
1369 return yield_as_sleep();
1370 }
1371
1372 auto r = prepare_usleep(timeout, waitq);
1373 switch_context(r.from, r.to);
1374 assert(r.from->waitq == nullptr);
1375 return r.from->set_error_number();
1376 }
1377
1378 typedef void (*defer_func)(void*);
1379 static int thread_usleep_defer(Timeout timeout,

Callers 5

thread_usleep_deferFunction · 0.70
stubMethod · 0.70
waitMethod · 0.70
cvar_do_waitFunction · 0.70
wait_allFunction · 0.70

Calls 9

yield_as_sleepFunction · 0.85
prepare_usleepFunction · 0.85
switch_contextFunction · 0.85
do_shutdown_usleepFunction · 0.85
do_thread_usleepFunction · 0.85
set_error_numberMethod · 0.80
is_shutting_downMethod · 0.80
unlikelyFunction · 0.50
expiredMethod · 0.45

Tested by

no test coverage detected