header file: pthread.h
int pthread_cancel(pthread_t thread);
header file: Windows.h
BOOL WINAPI TerminateThread(
__inout HANDLE hThread,
__in DWORD dwExitCode
);
The pthread_cancel function is a request to terminate the
execution of the thread pointed to by thread.
The Windows equivalent function will also terminate the called
for thread, but any DLLs associated with the terminated thread are
not notified. The thread’s stack is deleted. As pointed out
in the MSDN documentation, this is an extremely dangerous call
unless you know exactly what the thread to be terminated is doing
at the time of termination.
If the call is successful, the return value will be NON-zero. To
get more information you can call GetLastError.
Example of Use in Windows