const ThreadSupport_GETPRI_FAILED |
 |
The error status for getPriority when an error is captured in
the Error.Block
#define ThreadSupport_GETPRI_FAILED (Int)-2
const ThreadSupport_INVALID_OS_PRIORITY |
 |
Invalid OS priority value
#define ThreadSupport_INVALID_OS_PRIORITY (Int)0
enum ThreadSupport_CompStatus |
 |
Status returned by compareOsPriorities when an error occurs
typedef enum ThreadSupport_CompStatus {
ThreadSupport_CompStatus_ERROR,
ThreadSupport_CompStatus_LOWER,
ThreadSupport_CompStatus_EQUAL,
ThreadSupport_CompStatus_HIGHER
} ThreadSupport_CompStatus;
enum ThreadSupport_Priority |
 |
Thread priorities which are mapped to OS specific value by Proxy
typedef enum ThreadSupport_Priority {
ThreadSupport_Priority_INVALID,
ThreadSupport_Priority_LOWEST,
ThreadSupport_Priority_BELOW_NORMAL,
ThreadSupport_Priority_NORMAL,
ThreadSupport_Priority_ABOVE_NORMAL,
ThreadSupport_Priority_HIGHEST
} ThreadSupport_Priority;
typedef ThreadSupport_RunFxn |
 |
typedef for function that gets called when the Thread runs
typedef Void (*ThreadSupport_RunFxn)(IArg);
struct ThreadSupport_Stat |
 |
Struct to hold thread statistics from stat
typedef struct ThreadSupport_Stat {
SizeT stackSize;
SizeT stackUsed;
} ThreadSupport_Stat;
config ThreadSupport_A_POSIX_Error // module-wide |
 |
extern const Assert_Id ThreadSupport_A_POSIX_Error;
config ThreadSupport_E_POSIX_Error // module-wide |
 |
extern const Error_Id ThreadSupport_E_POSIX_Error;
config ThreadSupport_E_priority // module-wide |
 |
extern const Error_Id ThreadSupport_E_priority;
config ThreadSupport_L_finish // module-wide |
 |
extern const Log_Event ThreadSupport_L_finish;
config ThreadSupport_L_join // module-wide |
 |
config ThreadSupport_L_start // module-wide |
 |
extern const Log_Event ThreadSupport_L_start;
ThreadSupport_compareOsPriorities() // module-wide |
 |
Compare two priority values and find out which one represents a
higher priority
Int ThreadSupport_compareOsPriorities(
Int p1,
Int p2,
Error_Block *
eb);
ARGUMENTS
p1
priority one
p2
priority two
eb
Pointer to Error.Block
DETAILS
RETURNS
Refer to description above
ThreadSupport_self() // module-wide |
 |
Acquire the currently executing thread's handle
ARGUMENTS
eb
Pointer to Error.Block
DETAILS
Refer to
xdc.runtime.knl.Thread.self for more details.
RETURNS
Handle in case of success; null for error;
ThreadSupport_sleep() // module-wide |
 |
Sleep for certain number of microseconds
Bool ThreadSupport_sleep(
UInt timeout,
Error_Block *
eb);
ARGUMENTS
timeout
timeout in microseconds
eb
Pointer to Error.Block
DETAILS
RETURNS
true for success; false for failure
ThreadSupport_start() // module-wide |
 |
Start threads running
ARGUMENTS
eb
Pointer to Error.Block
DETAILS
RETURNS
true for success; false for failure
ThreadSupport_yield() // module-wide |
 |
Yield the currently scheduled thread
ARGUMENTS
eb
Pointer to Error.Block
DETAILS
RETURNS
true for success; false for failure
Module-Wide Built-Ins |
 |
// Get this module's unique id
Bool ThreadSupport_Module_startupDone();
// Test if this module has completed startup
// The heap from which this module allocates memory
Bool ThreadSupport_Module_hasMask();
// Test whether this module has a diagnostics mask
Bits16 ThreadSupport_Module_getMask();
// Returns the diagnostics mask for this module
Void ThreadSupport_Module_setMask(Bits16 mask);
// Set the diagnostics mask for this module
Instance Object Types |
 |
typedef struct ThreadSupport_Object ThreadSupport_Object;
// Opaque internal representation of an instance object
// Client reference to an instance object
typedef struct ThreadSupport_Struct ThreadSupport_Struct;
// Opaque client structure large enough to hold an instance object
// Convert this instance structure pointer into an instance handle
// Convert this instance handle into an instance structure pointer
Instance Config Parameters |
 |
typedef struct ThreadSupport_Params {
// Instance config-params structure
// Common per-instance configs
IArg arg;
// Thread function argument. Default is NULL
Int osPriority;
// OS specific thread priority
// Thread priority
SizeT stackSize;
// Thread stack size. If left at zero, OS default is used
Ptr tls;
// User-specified thread local storage data
} ThreadSupport_Params;
// Initialize this config-params structure with supplier-specified defaults before instance creation
config ThreadSupport_arg // instance |
 |
Thread function argument. Default is NULL
config ThreadSupport_osPriority // instance |
 |
OS specific thread priority
DETAILS
Used to specify an OS specific value for priority. If set this value
takes precedence over
priority.
config ThreadSupport_priority // instance |
 |
Thread priority
DETAILS
Thread defines several constants which allows applications to select
a priority in an OS independent way. Priority_LOWEST,
Priority_BELOW_NORMAL, Priority_NORMAL, Priority_ABOVE_NORMAL and
Priority_HIGHEST. These values get mapped to OS specific priorities
by the OS specific delegate.
config ThreadSupport_stackSize // instance |
 |
Thread stack size. If left at zero, OS default is used
config ThreadSupport_tls // instance |
 |
User-specified thread local storage data
Instance Creation |
 |
// Allocate and initialize a new instance object and return its handle
// Initialize a new instance object inside the provided structure
ARGUMENTS
fxn
function for new thread to begin execution
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 spawns a new thread calling the function fxn.
Instance Deletion |
 |
// Finalize and free this previously allocated instance object, setting the referenced handle to NULL
// Finalize the instance object inside the provided structure
ThreadSupport_getOsHandle() // instance |
 |
Get the OS thread handle
ARGUMENTS
handle
handle of a previously-created ThreadSupport instance object
RETURNS
null in case of error
ThreadSupport_getOsPriority() // instance |
 |
Obtain a thread's os specific priority
ARGUMENTS
handle
handle of a previously-created ThreadSupport instance object
eb
Pointer to Error.Block
DETAILS
For OSes that support dynamic priority boosting, the value returned
is the base priority of the thread.
RETURNS
thread priority in case of success; GETPRI_FAILED in
case of error;
ThreadSupport_getPriority() // instance |
 |
Obtain a thread's priority
ARGUMENTS
handle
handle of a previously-created ThreadSupport instance object
eb
Pointer to Error.Block
DETAILS
RETURNS
thread priority in case of success; Priority_INVALID in
case of error;
ThreadSupport_getTls() // instance |
 |
Obtain a thread's local storage pointer
ARGUMENTS
handle
handle of a previously-created ThreadSupport instance object
RETURNS
null in case of error
ThreadSupport_join() // instance |
 |
Join on a Thread
ARGUMENTS
handle
handle of a previously-created ThreadSupport instance object
eb
Pointer to Error.Block
DETAILS
Refer to
xdc.runtime.knl.Thread.join for more details.
RETURNS
true for success; false for failure
ThreadSupport_setOsPriority() // instance |
 |
Set a thread's priority
ARGUMENTS
handle
handle of a previously-created ThreadSupport instance object
newPri
new thread priority
eb
Pointer to Error.Block
DETAILS
This API sets the base priority of the thread on OSes that
support dynamic priority boosting
RETURNS
true for success; false for failure
ThreadSupport_setPriority() // instance |
 |
Set a thread's priority
ARGUMENTS
handle
handle of a previously-created ThreadSupport instance object
newPri
new thread priority
eb
Pointer to Error.Block
DETAILS
RETURNS
true for success; false for failure
ThreadSupport_setTls() // instance |
 |
Set a thread's local storage pointer
ARGUMENTS
handle
handle of a previously-created ThreadSupport instance object
tls
thread tls
ThreadSupport_stat() // instance |
 |
Obtain a thread's stats
ARGUMENTS
handle
handle of a previously-created ThreadSupport instance object
buf
Pointer to Stat
eb
Pointer to Error.Block
RETURNS
true for success; false for failure
Instance Convertors |
 |
// unconditionally move one level up the inheritance hierarchy
// conditionally move one level down the inheritance hierarchy; NULL upon failure
Instance Built-Ins |
 |
Int ThreadSupport_Object_count();
// The number of statically-created instance objects
// The handle of the i-th statically-created instance object (array == NULL)
// The handle of the first dynamically-created instance object, or NULL
// The handle of the next dynamically-created instance object, or NULL
// The heap used to allocate dynamically-created instance objects
// The label associated with this instance object
// The name of this instance object
const ThreadSupport.GETPRI_FAILED |
 |
The error status for getPriority when an error is captured in
the Error.Block
XDCscript usage |
meta-domain |
const ThreadSupport.GETPRI_FAILED = -2;
C SYNOPSIS
const ThreadSupport.INVALID_OS_PRIORITY |
 |
Invalid OS priority value
XDCscript usage |
meta-domain |
const ThreadSupport.INVALID_OS_PRIORITY = 0;
C SYNOPSIS
enum ThreadSupport.CompStatus |
 |
Status returned by compareOsPriorities when an error occurs
XDCscript usage |
meta-domain |
values of type ThreadSupport.CompStatus
const ThreadSupport.CompStatus_ERROR;
const ThreadSupport.CompStatus_LOWER;
const ThreadSupport.CompStatus_EQUAL;
const ThreadSupport.CompStatus_HIGHER;
C SYNOPSIS
enum ThreadSupport.Priority |
 |
Thread priorities which are mapped to OS specific value by Proxy
XDCscript usage |
meta-domain |
values of type ThreadSupport.Priority
const ThreadSupport.Priority_INVALID;
const ThreadSupport.Priority_LOWEST;
const ThreadSupport.Priority_BELOW_NORMAL;
const ThreadSupport.Priority_NORMAL;
const ThreadSupport.Priority_ABOVE_NORMAL;
const ThreadSupport.Priority_HIGHEST;
C SYNOPSIS
struct ThreadSupport.Stat |
 |
Struct to hold thread statistics from stat
XDCscript usage |
meta-domain |
var obj = new ThreadSupport.Stat;
obj.stackSize = SizeT ...
obj.stackUsed = SizeT ...
C SYNOPSIS
config ThreadSupport.A_POSIX_Error // module-wide |
 |
XDCscript usage |
meta-domain |
msg: "A_POSIX_Error: a POSIX function returned failure"
};
C SYNOPSIS
config ThreadSupport.E_POSIX_Error // module-wide |
 |
XDCscript usage |
meta-domain |
msg: "E_POSIX_Error: a POSIX function returned failure, errno is %d"
};
C SYNOPSIS
config ThreadSupport.E_priority // module-wide |
 |
XDCscript usage |
meta-domain |
msg: "E_priority: Thread priority is invalid %d"
};
C SYNOPSIS
config ThreadSupport.L_finish // module-wide |
 |
XDCscript usage |
meta-domain |
msg: "--> finish: (%p)"
};
C SYNOPSIS
config ThreadSupport.L_join // module-wide |
 |
XDCscript usage |
meta-domain |
C SYNOPSIS
config ThreadSupport.L_start // module-wide |
 |
XDCscript usage |
meta-domain |
msg: "<-- start: (%p)"
};
C SYNOPSIS
metaonly config ThreadSupport.common$ // module-wide |
 |
Common module configuration parameters
XDCscript usage |
meta-domain |
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 ThreadSupport.Params;
// Instance config-params object
params.arg = IArg null;
// Thread function argument. Default is NULL
// OS specific thread priority
// Thread priority
params.stackSize = SizeT 0;
// Thread stack size. If left at zero, OS default is used
params.tls = Ptr null;
// User-specified thread local storage data
config ThreadSupport.arg // instance |
 |
Thread function argument. Default is NULL
XDCscript usage |
meta-domain |
var params = new ThreadSupport.Params;
...
params.arg = IArg null;
C SYNOPSIS
config ThreadSupport.osPriority // instance |
 |
OS specific thread priority
XDCscript usage |
meta-domain |
var params = new ThreadSupport.Params;
...
DETAILS
Used to specify an OS specific value for priority. If set this value
takes precedence over
priority.
C SYNOPSIS
config ThreadSupport.priority // instance |
 |
Thread priority
XDCscript usage |
meta-domain |
var params = new ThreadSupport.Params;
...
DETAILS
Thread defines several constants which allows applications to select
a priority in an OS independent way. Priority_LOWEST,
Priority_BELOW_NORMAL, Priority_NORMAL, Priority_ABOVE_NORMAL and
Priority_HIGHEST. These values get mapped to OS specific priorities
by the OS specific delegate.
C SYNOPSIS
config ThreadSupport.stackSize // instance |
 |
Thread stack size. If left at zero, OS default is used
XDCscript usage |
meta-domain |
var params = new ThreadSupport.Params;
...
params.stackSize = SizeT 0;
C SYNOPSIS
config ThreadSupport.tls // instance |
 |
User-specified thread local storage data
XDCscript usage |
meta-domain |
var params = new ThreadSupport.Params;
...
params.tls = Ptr null;
C SYNOPSIS
Instance Creation |
 |
XDCscript usage |
meta-domain |
var params =
new ThreadSupport.
Params;
// Allocate instance config-params
params.config = ...
// Assign individual configs
var inst = ThreadSupport.create(Void(*)(IArg) fxn, params);
// Create an instance-object
ARGUMENTS
fxn
function for new thread to begin execution
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 spawns a new thread calling the function fxn.