i am using Win32 API.
i have a thread in c and want to terminate it from out side the thread so can’t use exitthread()
i can’t use any wait options cause i have to kill this thread and start it again in very short time.
need help,
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can thermiate the thread using TerminateThread using the thread handle you got from CreateThread.
see http://msdn.microsoft.com/en-us/library/ms686717(VS.85).aspx
Please note the warning in the MSDN site. Terminating a thread is dangerous.
Consider that the thread can have resources allocated, that will not released when you terminate it as you describe. Example: if the thread has entered a critical section and is terminated before leaving, you won’t be able to enter the CS with another thread.