INtime SDK Help
CILLSemaphore
This topic contains these sections:

The CILLSemaphore class encapsulates the low level RT semaphore object; it allows sending and receiving units, which may represent any application dependent resource. The CILLSemaphore class is typically used as it is.

Class members

Constructor

Destructor

Create

Release

Wait

The following member variables are only available to the members of the class and its derived classes:

KNHANDLE m_hLLObject; PVOID m_pArea;

The class member m_hRTObject is either NULL_RTHANDLE (not attached) or BAD_RTHANDLE (attached).

Inherited functions

The Lookup and Attach functions are useless as they operate on RTHANDLEs.

CILLSemaphore::Constructor

The constructor has no arguments. It creates an unattached object.

CILLSemaphore::Destructor

If the object is attached, the destructor detaches it; then it destroys the object.

CILLSemaphore::Create

If the object is already attached, it is first detached. Then this call creates an low level RT semaphore object and attaches it to the object.

Syntax

DWORD CILLSemaphore::Create(
    DWORD dwFlags
);

Parameters

dwFlags
Indicates the type of semaphore: KN_FIFO_QUEUEING, K_PRIORITY_QUEUEING or KN_REGION; if omitted, KN_FIFO_QUEUEING is assumed. The first two types have a maximum number of units of 65535 and are created with 0 units. The KN_REGION type should normally be combined with KN_ONE_UNIT and then has a maximum of 1 and is created with 1 unit. The result is a status indicating success or failure.

Status

E_OK
No exceptional conditions occurred.

CILLSemaphore::Release

With this call one unit is released to the semaphore.

Syntax

DWORD CILLSemaphore::Release(void);

The result is a status indicating success or failure.

Status

E_OK
No exceptional conditions occurred.
E_EXIST
The object is not attached.

CILLSemaphore::Wait

This call puts the thread in a sleep state until one unit is available, or until a timeout occurs.

Syntax

DWORD CILLSemaphore::Wait(
    DWORD dwUsecs
);

Parameters

dwUsecs
Defines how long the thread will wait (in usecs) and may be omitted (meaning WAIT_FOREVER). The result is a status indicating success or failure.

Status

E_OK
No exceptional conditions occurred.
E_KN_TIME_OUT
No unit was available during the waiting period.
E_KN_NONEXIST
The semaphore was deleted while the thread was waiting.
E_EXIST
The object is not attached.

 

See Also

Semaphores