SyncManager.CreateSemaphore

Syntax

SyncManager.CreateSemaphore( name, initialCount, maxCount, alreadyExists)

Return Value

Semaphore

Purpose

Creates or retrieves a Semaphore object with the name and settings you specify.

Parameters

name As String

[In] Specifies a unique name for the Synchronization object. When the Synchronization object name begins with an asterisk, * , such as *syncobjectname , processes can share the object.

When the Synchronization object name begins with a computer name, such as \\computername\syncobjectname , you can share the object among computers, but the object resides on the computer for which you specify a name.

When the Synchronization object name begins with an asterisk or computer name, you can use a 32 or 64 prefix to specify using 32- or 64-bit TestStand to host the out-of-process Synchronization object. For example, the name 64*syncobj specifies a Synchronization object called *syncobj in the 64-bit TestStand host process, even when used from 32-bit TestStand. Use the prefix to share Synchronization objects between 32-bit TestStand and 64-bit TestStand in the same host process. If you do not use the prefix, 32-bit TestStand hosts out-of-process Synchronization objects in a 32-bit process, and 64-bit TestStand hosts out-of-process Synchronization objects in a 64-bit process.

initialCount As Long

[In] Specifies the initial value for the count. This value must be greater than or equal to 0.

When the alreadyExists parameter returns True to indicate a semaphore already exists, TestStand ignores this value.

maxCount As Long

[In] Specifies the max count allowed for the semaphore. Release operations that result in a count greater than the max count return an error. Normally, you pass 0x80000000 as the value for this parameter.

When the alreadyExists parameter returns True to indicate a semaphore already exists, this value is ignored.

alreadyExists As Boolean

[Out] Returns True when the Synchronization object for which you specify a name already exists.

When the object already exists, this method returns the existing object rather than creating a new object.

See Also

Semaphore