module ti.sdo.xdcruntime.linux.SemThreadSupport
C synopsis target-domain sourced in ti/sdo/xdcruntime/linux/SemThreadSupport.xdc
#include <ti/sdo/xdcruntime/linux/SemThreadSupport.h>
Functions
Void
Void
Void
Void
Functions common to all ISemaphore modules
Int 
Bool 
Functions common to all target instances
Functions common to all target modules
Defines
#define
Typedefs
typedef enum
typedef struct
typedef struct
typedef enum
typedef struct
Constants
extern const Assert_Id 
extern const Error_Id 
extern const Error_Id 
 
const SemThreadSupport_FOREVER

Used as the timeout value to specify wait forever

C synopsis target-domain
#define SemThreadSupport_FOREVER (UInt)~(0)
enum SemThreadSupport_Mode

Types of semaphores

C synopsis target-domain
typedef enum SemThreadSupport_Mode {
    SemThreadSupport_Mode_COUNTING,
    // Counting semaphore
    SemThreadSupport_Mode_BINARY
    // Binary Semaphore
} SemThreadSupport_Mode;
enum SemThreadSupport_PendStatus

Error codes returned by Semaphore_pend

C synopsis target-domain
typedef enum SemThreadSupport_PendStatus {
    SemThreadSupport_PendStatus_ERROR,
    SemThreadSupport_PendStatus_TIMEOUT,
    SemThreadSupport_PendStatus_SUCCESS
} SemThreadSupport_PendStatus;
config SemThreadSupport_A_POSIX_Error  // module-wide
C synopsis target-domain
extern const Assert_Id SemThreadSupport_A_POSIX_Error;
config SemThreadSupport_E_POSIX_Error  // module-wide
C synopsis target-domain
extern const Error_Id SemThreadSupport_E_POSIX_Error;
config SemThreadSupport_E_resetError  // module-wide
C synopsis target-domain
extern const Error_Id SemThreadSupport_E_resetError;
Module-Wide Built-Ins

C synopsis target-domain
Types_ModuleId SemThreadSupport_Module_id();
// Get this module's unique id
 
Bool SemThreadSupport_Module_startupDone();
// Test if this module has completed startup
 
IHeap_Handle SemThreadSupport_Module_heap();
// The heap from which this module allocates memory
 
Bool SemThreadSupport_Module_hasMask();
// Test whether this module has a diagnostics mask
 
Bits16 SemThreadSupport_Module_getMask();
// Returns the diagnostics mask for this module
 
Void SemThreadSupport_Module_setMask(Bits16 mask);
// Set the diagnostics mask for this module
Instance Object Types

C synopsis target-domain
typedef struct SemThreadSupport_Object SemThreadSupport_Object;
// Opaque internal representation of an instance object
 
typedef SemThreadSupport_Object *SemThreadSupport_Handle;
// Client reference to an instance object
 
typedef struct SemThreadSupport_Struct SemThreadSupport_Struct;
// Opaque client structure large enough to hold an instance object
 
SemThreadSupport_Handle SemThreadSupport_handle(SemThreadSupport_Struct *structP);
// Convert this instance structure pointer into an instance handle
 
SemThreadSupport_Struct *SemThreadSupport_struct(SemThreadSupport_Handle handle);
// Convert this instance handle into an instance structure pointer
Instance Config Parameters

C synopsis target-domain
typedef struct SemThreadSupport_Params {
// Instance config-params structure
    IInstance_Params *instance;
    // Common per-instance configs
    ISemaphore_Mode mode;
    // Semaphore mode. Default is COUNTING
} SemThreadSupport_Params;
 
Void SemThreadSupport_Params_init(SemThreadSupport_Params *params);
// Initialize this config-params structure with supplier-specified defaults before instance creation
config SemThreadSupport_mode  // instance

Semaphore mode. Default is COUNTING

C synopsis target-domain
      ...
    ISemaphore_Mode mode;
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.
Instance Creation

C synopsis target-domain
SemThreadSupport_Handle SemThreadSupport_create(Int count, const SemThreadSupport_Params *params, Error_Block *eb);
// Allocate and initialize a new instance object and return its handle
 
Void SemThreadSupport_construct(SemThreadSupport_Struct *structP, Int count, const SemThreadSupport_Params *params, Error_Block *eb);
// Initialize a new instance object inside the provided structure
ARGUMENTS
count — initial semaphore count
params — per-instance config params, or NULL to select default values (target-domain only)
eb — active error-handling block, or NULL to select default policy (target-domain only)
DETAILS
This function creates a new Semaphore object which is initialized to count.
Instance Deletion

C synopsis target-domain
Void SemThreadSupport_delete(SemThreadSupport_Handle *handleP);
// Finalize and free this previously allocated instance object, setting the referenced handle to NULL
 
Void SemThreadSupport_destruct(SemThreadSupport_Struct *structP);
// Finalize the instance object inside the provided structure
SemThreadSupport_pend()  // instance

Wait for the semaphore to become available

C synopsis target-domain
Int SemThreadSupport_pend(SemThreadSupport_Handle handle, UInt timeout, Error_Block *eb);
ARGUMENTS
handle — handle of a previously-created SemThreadSupport instance object
timeout — timeout in microseconds
eb — error block
DETAILS
RETURNS
refer to description above
SemThreadSupport_post()  // instance

Increment the semaphore count

C synopsis target-domain
Bool SemThreadSupport_post(SemThreadSupport_Handle handle, Error_Block *eb);
ARGUMENTS
handle — handle of a previously-created SemThreadSupport instance object
eb — error block
RETURNS
true for success, false for error in error block
Instance Convertors

C synopsis target-domain
ISemThreadSupport_Handle SemThreadSupport_Handle_upCast(SemThreadSupport_Handle handle);
// unconditionally move one level up the inheritance hierarchy
 
SemThreadSupport_Handle SemThreadSupport_Handle_downCast(ISemThreadSupport_Handle handle);
// conditionally move one level down the inheritance hierarchy; NULL upon failure
 
ISemaphore_Handle SemThreadSupport_Handle_upCast2(SemThreadSupport_Handle handle);
// unconditionally move 2 levels up the inheritance hierarchy
 
SemThreadSupport_Handle SemThreadSupport_Handle_downCast2(ISemaphore_Handle handle);
// conditionally move 2 levels down the inheritance hierarchy; NULL upon failure
Instance Built-Ins

C synopsis target-domain
Int SemThreadSupport_Object_count();
// The number of statically-created instance objects
 
SemThreadSupport_Handle SemThreadSupport_Object_get(SemThreadSupport_Object *array, Int i);
// The handle of the i-th statically-created instance object (array == NULL)
 
SemThreadSupport_Handle SemThreadSupport_Object_first();
// The handle of the first dynamically-created instance object, or NULL
 
SemThreadSupport_Handle SemThreadSupport_Object_next(SemThreadSupport_Handle handle);
// The handle of the next dynamically-created instance object, or NULL
 
IHeap_Handle SemThreadSupport_Object_heap();
// The heap used to allocate dynamically-created instance objects
 
Types_Label *SemThreadSupport_Handle_label(SemThreadSupport_Handle handle, Types_Label *buf);
// The label associated with this instance object
 
String SemThreadSupport_Handle_name(SemThreadSupport_Handle handle);
// The name of this instance object
 
XDCscript usage meta-domain sourced in ti/sdo/xdcruntime/linux/SemThreadSupport.xdc
var SemThreadSupport = xdc.useModule('ti.sdo.xdcruntime.linux.SemThreadSupport');
module-wide constants & types
        const SemThreadSupport.PendStatus_ERROR;
        const SemThreadSupport.PendStatus_TIMEOUT;
        const SemThreadSupport.PendStatus_SUCCESS;
module-wide config parameters
        msg: "A_POSIX_Error: a POSIX function returned failure"
    };
        msg: "E_POSIX_Error: a POSIX function returned failure, errno is %d"
    };
        msg: "E_resetError: %s returned failure"
    };
per-instance config parameters
    var params = new SemThreadSupport.Params// Instance config-params object;
per-instance creation
    var inst = SemThreadSupport.create// Create an instance-object(Int count, params);
 
const SemThreadSupport.FOREVER

Used as the timeout value to specify wait forever

XDCscript usage meta-domain
const SemThreadSupport.FOREVER = ~(0);
C SYNOPSIS
enum SemThreadSupport.Mode

Types of semaphores

XDCscript usage meta-domain
values of type SemThreadSupport.Mode
    const SemThreadSupport.Mode_COUNTING;
    // Counting semaphore
    const SemThreadSupport.Mode_BINARY;
    // Binary Semaphore
C SYNOPSIS
enum SemThreadSupport.PendStatus

Error codes returned by Semaphore_pend

XDCscript usage meta-domain
values of type SemThreadSupport.PendStatus
    const SemThreadSupport.PendStatus_ERROR;
    const SemThreadSupport.PendStatus_TIMEOUT;
    const SemThreadSupport.PendStatus_SUCCESS;
C SYNOPSIS
config SemThreadSupport.A_POSIX_Error  // module-wide
XDCscript usage meta-domain
SemThreadSupport.A_POSIX_Error = Assert.Desc {
    msg: "A_POSIX_Error: a POSIX function returned failure"
};
C SYNOPSIS
config SemThreadSupport.E_POSIX_Error  // module-wide
XDCscript usage meta-domain
SemThreadSupport.E_POSIX_Error = Error.Desc {
    msg: "E_POSIX_Error: a POSIX function returned failure, errno is %d"
};
C SYNOPSIS
config SemThreadSupport.E_resetError  // module-wide
XDCscript usage meta-domain
SemThreadSupport.E_resetError = Error.Desc {
    msg: "E_resetError: %s returned failure"
};
C SYNOPSIS
metaonly config SemThreadSupport.common$  // module-wide

Common module configuration parameters

XDCscript usage meta-domain
SemThreadSupport.common$ = Types.Common$ undefined;
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.
Instance Config Parameters

XDCscript usage meta-domain
var params = new SemThreadSupport.Params;
// Instance config-params object
    params.mode = ISemaphore.Mode ISemaphore.Mode_COUNTING;
    // Semaphore mode. Default is COUNTING
config SemThreadSupport.mode  // instance

Semaphore mode. Default is COUNTING

XDCscript usage meta-domain
var params = new SemThreadSupport.Params;
  ...
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.
C SYNOPSIS
Instance Creation

XDCscript usage meta-domain
var params = new SemThreadSupport.Params;
// Allocate instance config-params
params.config =   ...
// Assign individual configs
 
var inst = SemThreadSupport.create(Int count, params);
// Create an instance-object
ARGUMENTS
count — initial semaphore count
params — per-instance config params, or NULL to select default values (target-domain only)
eb — active error-handling block, or NULL to select default policy (target-domain only)
DETAILS
This function creates a new Semaphore object which is initialized to count.
generated on Fri, 29 Oct 2010 00:26:49 GMT