interface xdc.runtime.knl.ISemProcessSupport

Interface for OS specific back-end. [EXPERIMENTAL]

The xdc.runtime.knl package contains modules that provide typical OS services. These xdc.runtime.knl modules however require proxies to be bound to an OS specific delegate. This specifies the interface to be implemented by the OS specific delegate for xdc.runtime.knl.SemProcess module. [ more ... ]
XDCspec summary sourced in xdc/runtime/knl/ISemProcessSupport.xdc
interface ISemProcessSupport {  ...
    // inherits xdc.runtime.IModule
instance:  ...
XDCspec declarations sourced in xdc/runtime/knl/ISemProcessSupport.xdc
package xdc.runtime.knl;
 
interface ISemProcessSupport inherits ISemaphore {
module-wide constants & types
 
    };
 
        PendStatus_ERROR,
        PendStatus_TIMEOUT,
        PendStatus_SUCCESS
    };
module-wide config parameters
 
 
instance:
per-instance config parameters
per-instance creation
    create// Create an instance-object( Int count, Int key );
per-instance functions
}
C synopsis target-domain
DETAILS
The xdc.runtime.knl package contains modules that provide typical OS services. These xdc.runtime.knl modules however require proxies to be bound to an OS specific delegate. This specifies the interface to be implemented by the OS specific delegate for xdc.runtime.knl.SemProcess module.
create() takes a 32-bit integer key parameter to be used for identifying the semaphore to create across processes. For example, for Linux System V semaphores, the key is necessary so that different processes can access the same semaphore.
 
const ISemProcessSupport.FOREVER

Used as the timeout value to specify wait forever

XDCspec declarations sourced in xdc/runtime/knl/ISemProcessSupport.xdc
const UInt FOREVER = ~(0);
 
 
enum ISemProcessSupport.Mode

Types of semaphores

XDCspec declarations sourced in xdc/runtime/knl/ISemProcessSupport.xdc
enum Mode {
    Mode_COUNTING,
    // Counting semaphore
    Mode_BINARY
    // Binary Semaphore
};
 
 
enum ISemProcessSupport.PendStatus

Error codes returned by Semaphore_pend

XDCspec declarations sourced in xdc/runtime/knl/ISemProcessSupport.xdc
enum PendStatus {
    PendStatus_ERROR,
    PendStatus_TIMEOUT,
    PendStatus_SUCCESS
};
 
 
metaonly config ISemProcessSupport.common$  // module-wide

Common module configuration parameters

XDCspec declarations sourced in xdc/runtime/knl/ISemProcessSupport.xdc
metaonly config Types.Common$ common$;
 
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

C synopsis target-domain
typedef struct ISemProcessSupport_Object *ISemProcessSupport_Handle;
// Client reference to an abstract instance object
 
per-instance config parameters

XDCscript usage meta-domain
var params = new ISemProcessSupport.Params;
// Instance config-params object
    params.mode = ISemaphore.Mode ISemaphore.Mode_COUNTING;
    // Semaphore mode. Default is COUNTING
C synopsis target-domain
typedef struct ISemProcessSupport_Params {
// Instance config-params structure
    IInstance_Params *instance;
    // Common per-instance configs
    ISemaphore_Mode mode;
    // Semaphore mode. Default is COUNTING
} ISemProcessSupport_Params;
 
config ISemProcessSupport.mode  // per-instance

Semaphore mode. Default is COUNTING

XDCspec declarations sourced in xdc/runtime/knl/ISemProcessSupport.xdc
 
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.
 
per-instance creation

XDCspec declarations sourced in xdc/runtime/knl/ISemProcessSupport.xdc
create( Int count, Int key );
// Create an instance-object
ARGUMENTS
count — initial semaphore count
key — globally unique key
DETAILS
This function creates a new SemProcess object which is initialized to count. All semaphores created with the same key reference the same underlying synchronization object and work between processes. The underlying synchronization object should be automatically deleted when all references to it have been deleted, and the reference count should be maintained consistently across process forks or similar operations. An implementation for a platform on which this is technically impossible (e.g. an operating system that does not support multiple processes) may provide a 'toy' implementation with behavior matching that of ISemProcessSupport.
 
ISemProcessSupport.pend( )  // per-instance

Wait for the semaphore to become available

XDCspec declarations sourced in xdc/runtime/knl/ISemProcessSupport.xdc
Int pend( UInt timeout, Error.Block *eb );
 
ARGUMENTS
timeout — timeout in microseconds
eb — error block
DETAILS
RETURNS
refer to description above
 
ISemProcessSupport.post( )  // per-instance

Increment the semaphore count

XDCspec declarations sourced in xdc/runtime/knl/ISemProcessSupport.xdc
Bool post( Error.Block *eb );
 
ARGUMENTS
eb — error block
RETURNS
true for success, false for error in error block
 
per-instance convertors

C synopsis target-domain
ISemaphore_Handle ISemProcessSupport_Handle_upCast( ISemProcessSupport_Handle handle );
// unconditionally move one level up the inheritance hierarchy
 
ISemProcessSupport_Handle ISemProcessSupport_Handle_downCast( ISemaphore_Handle handle );
// conditionally move one level down the inheritance hierarchy; NULL upon failure
generated on Sat, 01 Aug 2009 01:23:52 GMT