ARGOBOTS
Functions
Self

Functions

int ABT_self_get_type (ABT_unit_type *type)
 Return the type of calling work unit. More...
 
int ABT_self_is_primary (ABT_bool *flag)
 Check if the caller is the primary ULT. More...
 
int ABT_self_on_primary_xstream (ABT_bool *flag)
 Check if the caller's ES is the primary ES. More...
 
int ABT_self_get_last_pool_id (int *pool_id)
 Get the last pool's ID of calling work unit. More...
 
int ABT_self_suspend (void)
 Suspend the current ULT. More...
 
int ABT_self_set_arg (void *arg)
 Set the argument for the work unit function. More...
 
int ABT_self_get_arg (void **arg)
 Retrieve the argument for the work unit function. More...
 

Detailed Description

This group is for the self wok unit.

Function Documentation

int ABT_self_get_arg ( void **  arg)

Retrieve the argument for the work unit function.

ABT_self_get_arg() returns the argument for the caller's work unit function. If the caller is a ULT, this routine returns the function argument passed to ABT_thread_create() when the caller was created or set by ABT_thread_set_arg(). On the other hand, if the caller is a tasklet, this routine returns the function argument passed to ABT_task_create().

Parameters
[out]argargument for the work unit function
Returns
Error code
Return values
ABT_SUCCESSon success

Definition at line 324 of file self.c.

int ABT_self_get_last_pool_id ( int *  pool_id)

Get the last pool's ID of calling work unit.

ABT_self_get_last_pool_id() returns the last pool's ID of caller work unit. If the work unit is not running, this routine returns the ID of the pool where it is residing. Otherwise, it returns the ID of the last pool where the work unit was (i.e., the pool from which the work unit was popped). NOTE: If this routine is not called by Argobots work unit (ULT or tasklet), pool_id will be set to -1.

Parameters
[out]pool_idpool id
Returns
Error code
Return values
ABT_SUCCESSon success
ABT_ERR_UNINITIALIZEDArgobots has not been initialized
ABT_ERR_INV_XSTREAMcalled by an external thread, e.g., pthread

Definition at line 177 of file self.c.

int ABT_self_get_type ( ABT_unit_type type)

Return the type of calling work unit.

ABT_self_get_type() returns the type of calling work unit, e.g., ABT_UNIT_TYPE_THREAD for ULT and ABT_UNIT_TYPE_TASK for tasklet, through type. If this routine is called when Argobots has not been initialized, type will be set to ABT_UNIT_TYPE_EXT, and ABT_ERR_UNINITIALIZED will be returned. If this routine is called by an external thread, e.g., pthread, type will be set to ABT_UNIT_TYPE_EXT, and ABT_ERR_INV_XSTREAM will be returned.

Parameters
[out]typework unit type.
Returns
Error code
Return values
ABT_SUCCESSon success
ABT_ERR_UNINITIALIZEDArgobots has not been initialized
ABT_ERR_INV_XSTREAMcalled by an external thread, e.g., pthread

Definition at line 31 of file self.c.

int ABT_self_is_primary ( ABT_bool flag)

Check if the caller is the primary ULT.

ABT_self_is_primary() confirms whether the caller is the primary ULT and returns the result through flag. If the caller is the primary ULT, flag is set to ABT_TRUE. Otherwise, flag is set to ABT_FALSE.

Parameters
[out]flagresult (ABT_TRUE: primary ULT, ABT_FALSE: not)
Returns
Error code
Return values
ABT_SUCCESSon success
ABT_ERR_UNINITIALIZEDArgobots has not been initialized
ABT_ERR_INV_XSTREAMcalled by an external thread, e.g., pthread
ABT_ERR_INV_THREADcalled by a tasklet

Definition at line 72 of file self.c.

int ABT_self_on_primary_xstream ( ABT_bool flag)

Check if the caller's ES is the primary ES.

ABT_self_on_primary_xstream() checks whether the caller work unit is associated with the primary ES. If the caller is running on the primary ES, flag is set to ABT_TRUE. Otherwise, flag is set to ABT_FALSE.

Parameters
[out]flagresult (ABT_TRUE: primary ES, ABT_FALSE: not)
Returns
Error code
Return values
ABT_SUCCESSon success
ABT_ERR_UNINITIALIZEDArgobots has not been initialized
ABT_ERR_INV_XSTREAMcalled by an external thread, e.g., pthread

Definition at line 122 of file self.c.

int ABT_self_set_arg ( void *  arg)

Set the argument for the work unit function.

ABT_self_set_arg() sets the argument for the caller's work unit function.

Parameters
[in]argargument for the work unit function
Returns
Error code
Return values
ABT_SUCCESSon success

Definition at line 274 of file self.c.

int ABT_self_suspend ( void  )

Suspend the current ULT.

ABT_self_suspend() suspends the execution of current ULT and switches to the scheduler. The caller ULT is not pushed to its associated pool and its state becomes BLOCKED. It can be awakened and be pushed back to the pool when ABT_thread_resume() is called.

This routine must be called by a ULT. Otherwise, it returns ABT_ERR_INV_THREAD without suspending the caller.

Returns
Error code
Return values
ABT_SUCCESSon success
ABT_ERR_INV_THREADcalled by a non-ULT

Definition at line 231 of file self.c.