Handle partial nanosleeps in this_thread::sleep_for
Signals may result in nanosleep returning with only some of the requested sleeping performed. Utilize nanosleep's "time-remaining" out parameter to continue sleeping when this occurs. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@210210 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -121,7 +121,9 @@ sleep_for(const chrono::nanoseconds& ns)
|
||||
ts.tv_sec = ts_sec_max;
|
||||
ts.tv_nsec = giga::num - 1;
|
||||
}
|
||||
nanosleep(&ts, 0);
|
||||
|
||||
while (nanosleep(&ts, &ts) == -1 && errno == EINTR)
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user