i m trying to terminate a thread when it is executing . could anyone help me how to go about this...
thanks,
aravind

CTRL C seems to work in many cases if it's a command line situation.

i m trying to terminate a thread when it is executing . could anyone help me how to go about this...
thanks,
aravind

Depends on the operating system, how the thread was created and how you want to terminate it. If you used win32 api function CreateThread() then look at the link scroll down the page and it will show you several functions that you can use to manipulate threads.

The way I have done it is to set a global flag that is initially FALSE. When you want the thread to terminate, set that flag to TRUE. Then inside the thread itself you must code it to periodically inspect that thread and stop execution when TRUE is detected.

There are other ways but some of them can be dangerous.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.