Lock Method (ASemaphore)

Acquire and decrease the object count by 1.

Syntax

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

The Lock method syntax has the following parts:

 

Name

Type

Description

Object

ASemaphore

ASemaphore object

lTimeOut

Val Variant

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

bAcquired

Bool

A boolean expression that specifies whether the object is acquired and the count decreased by one.

Where

bAcquired can be one of the following:

 

Value

Description

True *

The ASemaphore object is acquired and the count is decreased by one.

False

The ASemaphore object is not acquired or changed.

Example

The following statement attempts to acquire the ASemaphore object in 100 milliseconds and decreases the count by one:

bsem1Locked = sem1.Lock(100)

Applies to

ASemaphore

See Also

Unlock