MCPcopy Create free account
hub / github.com/apple/foundationdb / threadSleep

Function threadSleep

flow/Platform.actor.cpp:2794–2810  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2792} // namespace platform
2793
2794void threadSleep(double seconds) {
2795#ifdef _WIN32
2796 Sleep((DWORD)(seconds * 1e3));
2797#elif (defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__))
2798 struct timespec req, rem;
2799
2800 req.tv_sec = seconds;
2801 req.tv_nsec = (seconds - req.tv_sec) * 1e9L;
2802
2803 while (nanosleep(&req, &rem) == -1 && errno == EINTR) {
2804 req.tv_sec = rem.tv_sec;
2805 req.tv_nsec = rem.tv_nsec;
2806 }
2807#else
2808#error Port me!
2809#endif
2810}
2811
2812void threadYield() {
2813#ifdef _WIN32

Callers 12

checkThreadFunction · 0.85
writeMethod · 0.85
openMethod · 0.85
closeMethod · 0.85
whenFunction · 0.85
Future<int> spawnProcessFunction · 0.85
writeMethod · 0.85
setAbortFunction · 0.85
releaseMemFunction · 0.85
destroyFunction · 0.85
cancelFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected