Skip to content

Commit

Permalink
Fix wait of conditional variable to prevent spurious wakeup
Browse files Browse the repository at this point in the history
  • Loading branch information
z16166 authored and gittiver committed Jul 19, 2024
1 parent c63e977 commit fed82a3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion include/crow/app.h
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,7 @@ namespace crow
{
{
std::unique_lock<std::mutex> lock(start_mutex_);
if (!server_started_)
while (!server_started_)
cv_started_.wait(lock);
}
if (server_)
Expand Down
2 changes: 1 addition & 1 deletion include/crow/http_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ namespace crow // NOTE: Already documented in "crow/app.h"
void wait_for_start()
{
std::unique_lock<std::mutex> lock(start_mutex_);
if (!server_started_)
while (!server_started_)
cv_started_.wait(lock);
}

Expand Down

0 comments on commit fed82a3

Please sign in to comment.