Semaphore Property (AProgram) |
v8 |
Returns a semaphore object which can be used to control access to shared resources.
[ ob = ] Object.Semaphore ( )
The Parameters property syntax has the following parts:
Name |
Type |
Description |
Object |
AProgram object |
|
ob |
Semaphore object |
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.
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()
AProgram.Semaphore, ASystem.Semaphore