File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -2772,7 +2772,16 @@ static void append_to_generated_text_from_generated_token_probs(llama_server_con
2772
2772
}
2773
2773
2774
2774
std::function<void (int )> shutdown_handler;
2775
- inline void signal_handler (int signal) { shutdown_handler (signal); }
2775
+ std::atomic_flag is_terminating = ATOMIC_FLAG_INIT;
2776
+ inline void signal_handler (int signal) {
2777
+ if (is_terminating.test_and_set ()) {
2778
+ // in case it hangs, we can force terminate the server by hitting Ctrl+C twice
2779
+ // this is for better developer experience, we can remove when the server is stable enough
2780
+ fprintf (stderr, " Received second interrupt, terminating immediately.\n " );
2781
+ exit (1 );
2782
+ }
2783
+ shutdown_handler (signal);
2784
+ }
2776
2785
2777
2786
int main (int argc, char **argv)
2778
2787
{
You can’t perform that action at this time.
0 commit comments