xHarbour Reference Documentation > Function Reference |
Compares two thread handles.
IsSameThread( <pThreadHandle1>, ; <pThreadHandle2> ) --> lIsSameThread
The function returns .T. (true) when both thread handles belong to the same thread, otherwise .F. (false) is returned.
The function compares the result of two expressions, or contents of two variables, and returns .T. (true) when both yield a thread handle belonging to the same thread.
See also: | GetCurrentThread(), GetThreadID(), IsValidThread(), StartThread(), ThreadSleep() |
Category: | Multi-threading functions , xHarbour extensions |
Source: | vm\thread.c |
LIB: | xhbmt.lib |
DLL: | xhbmtdll.dll |
// The example shows the result of IsSameThread() for running // and terminated threads. They are the same. PROCEDURE Main LOCAL pThread1, pThread2 CLS pThread1:= StartThread( "RunInThread" ) pThread2:= StartThread( "RunInThread" ) ? IsSameThread( pThread1, pThread2 ) // result: .F. ? IsSameThread( pThread1, pThread1 ) // result: .T. ThreadSleep( 500 ) // wait for threads' end ? IsSameThread( pThread1, pThread2 ) // result: .F. ? IsSameThread( pThread1, pThread1 ) // result: .T. RETURN PROCEDURE RunInThread() ThreadSleep( 100 ) RETURN
http://www.xHarbour.com