Suspend a thread and delete its thread specific C library memory and I/O resources.
void _cstop(RTHANDLE hThread);
hThread
hThread
is NULL_RTHANDLE, then the current thread is assumed. In this case, the thread is not suspended but its C library resources are deleted. No other C library calls may be made and the thread must be immediately deleted as shown in the example below. It is necessary to use this call if one thread deletes another. In normal operation, a thread deletes all its resources when it returns from its entry point. When another thread calls DeleteRtThread, the target thread does not exit in this fashion and resources are left unclaimed. This call does not delete resources associated with netlib.rsl or any other .rsl. To ensure that a thread deletes all associated resources, the thread should return from its outter most scope.
BOOLEAN DeleteThread(RTHANDLE hThread) { // is it a thread if (GetRtHandleType(hThread != THREAD_TYPE) { SetLastRtError(E_PARAM); return FALSE; } // suspend the thread and delete its thread specific resources _cstop(hThread); // delete the thread (it is suspended by now) return DeleteRtThread(hThread); }
If linking with ciff3m8.lib or ciff3mf.lib _cstop may be called for threads in other processes. If linked with clib.lib (RSL C-library) _cstop may be called upon thread only within the same process.
None.
Versions | Defined in | Include | Link to |
---|---|---|---|
INtime 3.0 | intime/rt/include/rt.h | rt.h | ciff3m8.lib, ciff3mf.lib, or clib.lib (INtime 3.2 or later) |