MCPcopy Create free account
hub / github.com/Tiiny-AI/PowerInfer / signal_handler

Function signal_handler

smallthinker/tools/server/server.cpp:3650–3659  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3648std::atomic_flag is_terminating = ATOMIC_FLAG_INIT;
3649
3650inline void signal_handler(int signal) {
3651 if (is_terminating.test_and_set()) {
3652 // in case it hangs, we can force terminate the server by hitting Ctrl+C twice
3653 // this is for better developer experience, we can remove when the server is stable enough
3654 fprintf(stderr, "Received second interrupt, terminating immediately.\n");
3655 exit(1);
3656 }
3657
3658 shutdown_handler(signal);
3659}
3660
3661int main(int argc, char ** argv) {
3662 // own arguments required by this example

Callers 1

mainFunction · 0.85

Calls 1

fprintfFunction · 0.85

Tested by

no test coverage detected