mirror of
https://github.com/yhirose/cpp-httplib
synced 2024-11-21 14:29:10 -07:00
Add sleep in handle_EINTR
This commit is contained in:
parent
ba638ff38e
commit
d82c82db2c
1 changed files with 4 additions and 1 deletions
|
@ -2951,7 +2951,10 @@ template <typename T> inline ssize_t handle_EINTR(T fn) {
|
||||||
ssize_t res = 0;
|
ssize_t res = 0;
|
||||||
while (true) {
|
while (true) {
|
||||||
res = fn();
|
res = fn();
|
||||||
if (res < 0 && errno == EINTR) { continue; }
|
if (res < 0 && errno == EINTR) {
|
||||||
|
std::this_thread::sleep_for(std::chrono::milliseconds{1});
|
||||||
|
continue;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
|
|
Loading…
Reference in a new issue