How to stop background thread

Hi friends,

As I am new in threading programming can anybody tell me solution for fallowing problem.

I am working on application which in C# and C++. In C++ I am running some thread which performs some IO. when user close the GUI(in C#). At the same time I have to close the background thread also.

Actually IO(Read/write operation) is going on in the thread context. I just have to return false from that function if user close the application.

How can I make check for the same?

Either use a flag which will help the thread to close itself by seeing its value. In the GUI just wait for the thread to stop before you close the GUI.
other wise try sending a signal to the thread and wait in the GUI for the the thread to end itself.
Topic archived. No new replies allowed.