SemWait
Waits on a semaphore to be signalled. This function is a blocking function. It will block the calling Cicode task until the operation is complete.
Note: This function is process-based, not computer-based, and so will only prevent access to a critical section within a single process. This function only works between Cicode tasks within the same process.
Syntax
SemWait(hSem, Timeout)
hSem:
The semaphore handle, returned from the SemOpen() function. The semaphore handle identifies the table where all data on the associated semaphore is stored.
Timeout:
Semaphore time-out time:
-1 - Wait until semaphore is clear (regardless of how long).
0 - Do not wait - return immediately. (This timeout can be used to check the state.)
> 0 - The number of seconds to wait if semaphore is not signalling, then return.
Return Value
0 (zero) if the semaphore has been gained, otherwise an error is returned.
Related Functions
Example
Status=SemWait(hSem,10);
IF Status=0 THEN
...
ELSE
Prompt("Could not get semaphore");
END
See Also