Cicode Programming Reference > Cicode Function Categories > Task Functions Introduction > SemClose

SemClose

Closes a semaphore opened with SemOpen(). You should close all semaphores when they are no longer required, because they consume memory. If any Cicode tasks are waiting on this semaphore, the tasks are released with an error.

Note: This function is process-based, not computer-based, and so will only prevent access to an importantsection within a single process. This function only works between Cicode tasks within the same process.

Syntax

SemClose(hSem)

hSem:

The semaphore handle, returned from the SemOpen() function. The semaphore handle identifies the table where all data on the associated semaphore is stored.

Return Value

0 (zero) if successful, otherwise an error is returned.

Related Functions

SemOpen, SemSignal, SemWait

Example

SemClose(hSem);

See Also

Task Functions