xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

HB_MutexTimeoutLock()

Tries to obtain a lock on a Mutex with timeout.

Syntax

HB_MutexTimeoutLock( <pMutexHandle> , ;
                     <nWaitMilliSecs> ) --> lSuccess

Arguments

<pMutexHandle>
This is the handle of the Mutex to lock. It is the return value of HB_MutexCreate().
<nWaitMilliSecs>
A numeric value specifying the maximum period of time to wait before the function returns when a lock cannot be obtained. The unit for this timeout period is 1/1000th of a second. If <nWaitMilliSecs> is omitted, the thread waits infinitely, i.e. the function does not return until a lock is obtained.

Return

The function returns .T. (true) when the Mutex is locked within the timeout period, and .F. (false) when no lock is obtained.

Description

The function works like HB_MutexLock() but accepts as second parameter a timeout value. The function returns when either a lock is obtained on the Mutex, or the timeout period has expired. The return value indicates if the current thread has obtained the lock.

Info

See also:GetCurrentThread(), GetThreadID(), HB_MutexCreate(), HB_MutexTimeoutLock(), HB_MutexTryLock(), HB_MutexUnlock(), Notify(), StartThread(), Subscribe()
Category: Multi-threading functions , Mutex 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