Semaphore Property (AProgram)

v8

Returns a semaphore object which can be used to control access to shared resources.

Syntax

[ ob = ] Object.Semaphore ( )

The Parameters property syntax has the following parts:

 

Name

Type

Description

Object

AProgram

AProgram object

ob

ASemaphore

Semaphore object

Comments

The Semaphore property can be used to synchronize access to the program resource when running multiple UUTs in parallel mode or when using multi-threads to access the resource. If using it to synchronize between different process set the name of the semaphore to a unique system wide from both process.

Example

The following example locks the program semaphore before calling the function (PerformSomethingProtected). If the semaphore is already locked by another thread, the lock method will wait until unlocked (from the other thread) and then will call the function.

Program.Semaphore.Name="ATEasy:Program:UUT243"

Program.Semaphore.Lock()

Program.PerformSomethingProtected()

Program.Semaphore.Unlock()

Applies to

ADriver, AProgram, ASystem

See Also

AProgram.Semaphore, ASystem.Semaphore