DosSuspendThread

Temporarily suspends processing of another thread within the current process until DosResumeThread is issued.

Syntax
DosSuspendThread(tid)

Parameters

 * tid (TID) - input : Thread identifier of the thread to be suspended.

Return Code

 * ulrc (APIRET) - returns:DosSuspendThread returns one of the following values:
 * 0 NO_ERROR
 * 309 ERROR_INVALID_THREADID

Remarks
A thread's execution is suspended when another thread in its process issues DosSuspendThread, specifying the ID of the target thread. The thread may not be suspended immediately because it may have locked some system resources that have to be freed first. However, the thread is not allowed to execute further application program instructions until a corresponding DosResumeThread is issued.

DosSuspendThread permits the suspension of only one other thread within the current process. If a thread needs to disable all thread switching within its process so that the calling thread can execute time-critical code, it issues DosEnterCritSec and DosExitCritSec.

DosKillThread will not terminate a thread that is suspended. Instead the suspended thread will be terminated when it resumes execution. For this reason, you should not kill the main thread of an application if there are any secondary threads that are suspended.

Note: This function is very powerful and must be used with extreme caution. It should be used only when the state of the target thread is known.

Related Functions

 * DosCreateThread
 * DosEnterCritSec
 * DosResumeThread