Semaphore Property (ASystem) |
version 8 |
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 |
ASystem object |
|
ob |
Semaphore object |
The Semaphore property can be used to synchronize access to a system 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 System before calling the function (PerformSomethingProtected). If the semaphore already locked by another thread, the lock method will wait until unlocked (from the other thread) and then call the function.
System.Semaphore.Lock()
System.PerformSomethingProtected()
System.Semaphore.Unlock()
ADriver.Semaphore, AProgram.Semaphore