interface xdc.runtime.knl.ISemaphore |
![](../../../Arrow_left.png) |
![](../../../Arrow_up.png) |
![](../../../Arrow_right.png) |
Interface implemented by all front-end semaphore providers
SemThread and
SemProcess. [EXPERIMENTAL]
Semaphores can be used for synchronization and mutual exclusion.
[
more ... ]
interface ISemaphore { ...
instance: ...
interface ISemaphore {
module-wide constants & types
};
};
module-wide config parameters
instance:
per-instance config parameters
per-instance functions
}
DETAILS
SemThread and
SemProcess. [EXPERIMENTAL]
Semaphores can be used for synchronization and mutual exclusion.
pend() is used to wait for a semaphore. The timeout parameter allows the
caller to wait until a timeout, wait indefinitely, or not wait at all.
The return value indicates whether or not the wait was successful.
post() is used to signal a semaphore. If no thread is waiting on the
semaphore, then post() increments the semaphore count (for binary
semaphores, the count is always 0 or 1).
const ISemaphore.FOREVER |
![](../../../Arrow_up.png) |
Used as the timeout value to specify wait forever
const UInt FOREVER = ~(0);
enum ISemaphore.Mode |
![](../../../Arrow_up.png) |
Types of semaphores
enum Mode {
Mode_COUNTING,
// Counting semaphore
Mode_BINARY
// Binary Semaphore
};
enum ISemaphore.PendStatus |
![](../../../Arrow_up.png) |
Error codes returned by Semaphore_pend
enum PendStatus {
PendStatus_ERROR,
PendStatus_TIMEOUT,
PendStatus_SUCCESS
};
metaonly config ISemaphore.common$ // module-wide |
![](../../../Arrow_up.png) |
Common module configuration parameters
DETAILS
All modules have this configuration parameter. Its name
contains the '$' character to ensure it does not conflict with
configuration parameters declared by the module. This allows
new configuration parameters to be added in the future without
any chance of breaking existing modules.
config ISemaphore.mode // instance |
![](../../../Arrow_up.png) |
Semaphore mode. Default is COUNTING
DETAILS
When mode is BINARY , the semaphore has only two states, available
and unavailable. When mode is COUNTING, the semaphore keeps track of
number of times a semaphore is posted.
ISemaphore.pend() // instance |
![](../../../Arrow_up.png) |
Wait for the semaphore to become available
ARGUMENTS
timeout
timeout in microseconds
eb
error block
DETAILS
RETURNS
refer to description above
ISemaphore.post() // instance |
![](../../../Arrow_up.png) |
Increment the semaphore count
ARGUMENTS
eb
error block
RETURNS
true for success, false for error in error block
generated on Thu, 16 Jun 2011 22:52:56 GMT