mirror of
https://github.com/browsermt/bergamot-translator.git
synced 2024-10-26 05:43:59 +03:00
Fix busy loop in windows (#131)
* Fix busy loop in windows * Nick wants the while loop gone * Fix continue leftover Co-authored-by: Nikolay Bogoychev <nheart@gmail.com>
This commit is contained in:
parent
a63533b241
commit
c61b2bdd10
@ -113,17 +113,15 @@ class Semaphore {
|
|||||||
|
|
||||||
|
|
||||||
void wait() {
|
void wait() {
|
||||||
while (true) {
|
switch (WaitForSingleObject(sem_, INFINITE)) {
|
||||||
switch (WaitForSingleObject(sem_, 0L)) {
|
case WAIT_OBJECT_0:
|
||||||
case WAIT_OBJECT_0:
|
return;
|
||||||
return;
|
case WAIT_ABANDONED:
|
||||||
case WAIT_ABANDONED:
|
ABORT("A semaphore can't be abandoned, confused by Windows");
|
||||||
ABORT("A semaphore can't be abandoned, confused by Windows");
|
case WAIT_TIMEOUT:
|
||||||
case WAIT_TIMEOUT:
|
ABORT("Timeout on an infinite wait?");
|
||||||
continue;
|
case WAIT_FAILED:
|
||||||
case WAIT_FAILED:
|
ABORT("Waiting on Semaphore failed {}", GetLastError());
|
||||||
ABORT("Waiting on Semaphore failed {}", GetLastError());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user