interface xdc.runtime.knl.ISync |
|
|
|
Interface to allow clients to select method of synchronization in an OS
independent way. [EXPERIMENTAL]
Modules that require the user to pick a synchronization method, will request
an
Handle. Clients of such modules can pick a blocking ISync
implementation or a non-blocking implementation.
[
more ... ]
interface ISync { ...
instance: ...
interface ISync {
module-wide constants & types
};
module-wide config parameters
instance:
per-instance creation
per-instance functions
}
#include <xdc/runtime/knl/ISync.h>
per-instance object types
per-instance config parameters
DETAILS
Modules that require the user to pick a synchronization method, will request
an
Handle. Clients of such modules can pick a blocking ISync
implementation or a non-blocking implementation.
This interface specifies two main functions
signal and
wait. These two functions are always used in pairs in modules that
use ISync instances. The signal() function is used to signal completion of
an activity. The wait() function will allow the module to block or poll for
completion of the same activity.
ISync mandates that the sync mechanism be binary and not support counters.
Although the wait function seems meaningless in the case of non-blocking
sync, it allows modules to be written generically and support all ISync
implementations. For non-blocking ISync like the wait() will return
FALSE to denote timeout.
const ISync.NO_WAIT |
|
Used to specify no waiting
const ISync.Q_BLOCKING |
|
Blocking quality
const Int Q_BLOCKING = 1;
DETAILS
Implementations with this "quality" may cause the calling thread to
block;
const ISync.WAIT_FOREVER |
|
Used to wait forever
const UInt WAIT_FOREVER = ~(0);
enum ISync.WaitStatus |
|
Error codes returned by Semaphore_pend
enum WaitStatus {
WaitStatus_ERROR,
WaitStatus_TIMEOUT,
WaitStatus_SUCCESS
};
metaonly config ISync.common$ // module-wide |
|
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.
per-instance object types |
|
typedef struct ISync_Object *ISync_Handle;
// Client reference to an abstract instance object
per-instance config parameters |
|
XDCscript usage |
meta-domain |
var params = new ISync.Params;
// Instance config-params object
typedef struct ISync_Params {
// Instance config-params structure
// Common per-instance configs
} ISync_Params;
per-instance creation |
|
create( );
// Create an instance-object
ISync.query( ) // per-instance |
|
Query for a particular quality
ARGUMENTS
qual
quality
RETURNS
TRUE or FALSE.
DETAILS
FALSE is returned if quality not supported.
ISync.signal( ) // per-instance |
|
Called at completion of an activity
DETAILS
This function is non-blocking. It is also required that the underlying
sync be binary in nature.
This function does not take an Error.Block intentionally because
it can be called from ISR context.
ISync.wait( ) // per-instance |
|
Called to wait/poll for completion of an activity
ARGUMENTS
timeout
Timeout
eb
Hist Pointer to Error.Block
RETURNS
Refer to description above
DETAILS
This function can block. Non-blocking implementations should return
false to indicate a timeout.
generated on Thu, 11 Jun 2009 20:48:04 GMT