Tech Support > Microsoft Windows > Development Resources > thread exits but not signaled
thread exits but not signaled
Posted by luca.toffanin@gmail.com on May 17th, 2007


Hi, i'm fighting with this problem:

in a multithread process a thread is communicating over a Virtual COM
port. At the end of communication activity, it closes COM and returns
from thred's function: sometimes happens that after thread exit
(thread function returns) it's state it's not signaled:
WaitForSingleObject return for timeout and GetExitCodeThread returns
STILL_ACTIVE. For test i insert a call to TerminateThread but it
fails(return ERROR_INVALID_PARAMETER) and after GetExitCodeThread
still return STILL_ACTIVE.

Question:
1. why my thread exits but not it's not signaled?
2. why TerminateThread fails?
3. Could an error on Virtual COM Port driver (maybe in CloseHandle)
causes this effect?

Posted by Sten Westerback \(MVP SDK 2005-6 :\) on June 1st, 2007



<luca.toffanin@gmail.com> wrote in message
news:1179396571.000423.246310@e65g2000hsc.googlegr oups.com...
properly, eg. you are actually checking another thread or kernel object. At
least i can't see any reason why it wouldn't exit unless you somehow have
corrupted the CRT so that it actually can't return. I assume you are using
_beginthread() instead of CreateThread()?


things like that -- if given the proper handle.

So verify that you have correct handle, that you haven't corrupted CRT
somehow and try to put a breakpoint at the end of the routine and singlestep
into the CRT to see where it stops.

- Sten