INtime SDK Help
INtime SDK v7.1 > About INtime > INtime Kernel > Global objects > CreateGlobalRtSemaphore

Creates a semaphore on a remote node indicated by the LOCATION parameter.

#include <rt.h> 

RTHANDLE CreateGlobalRtSemaphore(
    LOCATION hLoc, 
    UINT_16 InitUnits, 
    UINT_16 MaxUnits, 
    UINT_16 Flags


The location where the object is to be created.
The initial number of units to be in the custody of the new semaphore.
The maximum number of units over which the new semaphore is to have custody at any given time.
Specifies flags that control the creation of the semaphore. Possible values are described below.
FIFO_QUEUING Specifies that threads are queued on a First-In-First-Out basis. This value is mutually exclusive with the PRIORITY_QUEUING value.
PRIORITY_QUEUING Specifies that the threads waiting on this object will be queued on a priority basis.
REFCOUNT Specifies that this object is to be created as a reference-counted object.


Creates a semaphore on the node indicated by the LOCATION parameter, and returns a reference to that semaphore. An additional flag bit (REFCOUNT) is defined indicating that the object should be created with a reference counter. If the semaphore is not created with a reference counter, it is considered to be owned by the calling process, even though it is resident on the remote node. Thus if the local process is deleted the remote node's Global Objects Manager process is responsible for deleting the remote semaphore object. In the case of a reference-counted semaphore the object is only deleted after the reference count decrements to zero.

Return Values

A valid reference object handle
Failure. The function sets GetLastRtError to one of these values:
E_RESOURCE_LIMIT Insufficient resources are available to signal the remote node.
E_EXIST The maximum number of objects on the local node has been exceeded.
E_MEM Insufficient physical memory is available to create the reference object.
E_INVALID_ADDRESS (0x00E2) The address provided for hLoc is not a valid address.


Versions Defined in Include Link to
INtime 4.0 intime/rt/include/rt.h rt.h rt.lib
See Also