How to handle Ctrl-C event on a multi-threaded console application?

B

Basel

Hi All

I'm using SetConsoleCtrlHandler to handle Ctrl-C event. But I have a
problem using it in multi-threaded applications (it doesn't invoke
handler function).

What is the correct way to handle Ctrl-C event in a multi-threaded
application??


Basel
 
B

Basel

This sample works fine for single thread applications.
but it doesn't work for multi-threaded applications.

Basel
 
L

Ludwig

This sample works fine for single thread applications.
but it doesn't work for multi-threaded applications.

Basel

Also if you handle the event in every thread?
(see last remark on that page: My 2-cents. My experience with this is
that in a multi-threaded console application you MUST handle the event
in each working thread to capture reliably.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top