Skip to content

Commit

Permalink
std::atomic_flag
Browse files Browse the repository at this point in the history
  • Loading branch information
ngxson committed Feb 26, 2024
1 parent 7547ef5 commit 273d985
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions examples/server/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2768,12 +2768,11 @@ static void append_to_generated_text_from_generated_token_probs(llama_server_con
}

std::function<void(int)> shutdown_handler;
static bool is_terminating = false;
std::atomic_flag is_terminating = ATOMIC_FLAG_INIT;
inline void signal_handler(int signal) {
if (is_terminating) {
if (is_terminating.test_and_set()) {
exit(0); // force exit the process, in case it hangs
}
is_terminating = true;
shutdown_handler(signal);
}

Expand Down

0 comments on commit 273d985

Please sign in to comment.