xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

KillThread()

Kills a running thread.

Syntax

KillThread( <pThreadHandle> ) --> NIL

Arguments

<pThreadHandle>
This is the handle of the thread to terminate. A thread handle is returned from function StartThread().

Return

The return value is always NIL.

Description

Function KillThread() is provided for "emergency recovery", such as dead locks between threads. The function sends a thread termination request to the operating system for the specified thread and returns immediately. It does not guarantee that the thread has actually terminated when the function returns. Use JoinThread() to make sure the thread has terminated.

Important:  if a call to KillThread() becomes necessary, the program logic of the multi-threading application should be carefully revised. It is an indication for an error in the usage of multiple threads. To stop a thread from outside, use StopThread(). StopThread() works synchronously while KillThread() works asynchronously.

Info

See also:HB_MutexCreate(), JoinThread(), KillAllThreads(), StartThread(), StopThread(), ThreadSleep()
Category: Multi-threading functions , xHarbour extensions
Source:vm\thread.c
LIB:xhbmt.lib
DLL:xhbmtdll.dll


Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe