MCPcopy Create free account
hub / github.com/appdevforall/CodeOnTheGo / signal_handler

Function signal_handler

subprojects/llama.cpp/tools/server/server.cpp:22–31  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20static std::atomic_flag is_terminating = ATOMIC_FLAG_INIT;
21
22static inline void signal_handler(int signal) {
23 if (is_terminating.test_and_set()) {
24 // in case it hangs, we can force terminate the server by hitting Ctrl+C twice
25 // this is for better developer experience, we can remove when the server is stable enough
26 fprintf(stderr, "Received second interrupt, terminating immediately.\n");
27 exit(1);
28 }
29
30 shutdown_handler(signal);
31}
32
33// wrapper function that handles exceptions and logs errors
34// this is to make sure handler_t never throws exceptions; instead, it returns an error response

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected