@ggibson : I tried your code and with nim 1.4.6, ctrl_c_handler is not called, under Windows 10
I am not sure to be clear. So let's try to explain it another way: I have a web server in the main thread, that uses a sqllite db I need to create a thread as a background worker that do heavy work, in fact the web server, when asked, set some flags and work in the db, and the background thread handle the work I just need that when Ctrl C happens, all close nicely, the db and the worker thread, may be I doing it completly wrong, if so how to do it the good way?