Lock Method (AMutex)

Locks the object to gain access to it.

Syntax

[ bLocked = ] Object.Lock ( [lTimeOut] )

The Lock method syntax has the following parts:

 

Name

Type

Description

Object

AMutex

AMutex object

lTimeOut

Val Variant

The length of time in milliseconds to allow the method to attempt to acquire the object.

bLocked

Bool

A boolean expression that specifies whether the object is locked or unlocked.

Where

bLocked can be one of the following:

 

Value

Description

True *

The AMutex object is locked.

False

The AMutex object is not locked.

 Comments

This member function locks the mutex object. You can make multiple lock calls on the same thread, but the Unlock member function must be called a corresponding number of times before the object is unlocked. If the object is locked by another thread, the Lock member function blocks until either the object is released or a "possible deadlock" exception occurs.

Example

The following statement attempts to lock an AMutex object in 100 milliseconds:

bmutex1Locked = mutexMutex1.Lock(100)

Applies to

AMutex

See Also

Unlock