Skip to content
Snippets Groups Projects
Commit 6e117730 authored by rswindell's avatar rswindell
Browse files

For SLEEP() implementations which use nanosleep(), resume the sleep if/when

nanosleep was interrupted by a signal and the SLEEP parameter is > 1.
Previously, any signal wuold abort SLEEP() prematurely. A SLEEP(1) (yield)
behaves the same as before since 1 is a special value where a short-sleep
duration is fine/expected on occasion.
parent 5a76be8b
No related branches found
No related tags found
No related merge requests found
......@@ -297,7 +297,7 @@ DLLEXPORT int DLLCALL get_errno(void);
#else
#define SLEEP(x) ({ int sleep_msecs=x; struct timespec ts={0}; \
ts.tv_sec=(sleep_msecs/1000); ts.tv_nsec=((sleep_msecs%1000)*1000000); \
nanosleep(&ts, NULL); })
while(nanosleep(&ts, &ts) != 0 && errno==EINTR && x > 1); })
#endif
#define YIELD() SLEEP(1)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment