std::atomic_flag
This commit is contained in:
parent
7547ef5c6d
commit
273d985271
1 changed files with 2 additions and 3 deletions
|
@ -2768,12 +2768,11 @@ static void append_to_generated_text_from_generated_token_probs(llama_server_con
|
||||||
}
|
}
|
||||||
|
|
||||||
std::function<void(int)> shutdown_handler;
|
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) {
|
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
|
exit(0); // force exit the process, in case it hangs
|
||||||
}
|
}
|
||||||
is_terminating = true;
|
|
||||||
shutdown_handler(signal);
|
shutdown_handler(signal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue