ARGOBOTS  7496202f85916e93d6d143320764c2aba5026d93
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
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...
 
int ABT_self_is_unnamed (ABT_bool *flag)
 Check if the running work unit is unnamed. 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
ABT_ERR_UNINITIALIZEDArgobots has not been initialized
ABT_ERR_INV_XSTREAMcalled by an external thread

Definition at line 200 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

Definition at line 116 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, ABT_ERR_UNINITIALIZED will be returned. If this routine is called by an external thread, e.g., pthread, ABT_ERR_INV_XSTREAM will be returned.

Now type will be set to ABT_UNIT_TYPE_EXT when it returns an error, but this behavior is deprecated; the user should check the error code to check if this routine is called by a thread not managed by Argobots.

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

Definition at line 34 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

Definition at line 62 of file self.c.

int ABT_self_is_unnamed ( ABT_bool flag)

Check if the running work unit is unnamed.

ABT_self_is_unnamed() returns whether the current work units is unnamed or not. If the caller is an external thread, it sets ABT_FALSE and returns ABT_ERR_INV_XSTREAM.

Parameters
[out]flagresult (ABT_TRUE if unnamed)
Returns
Error code
Return values
ABT_SUCCESSon success
ABT_ERR_UNINITIALIZEDArgobots has not been initialized
ABT_ERR_INV_XSTREAMcalled by an external thread

Definition at line 224 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

Definition at line 87 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
ABT_ERR_UNINITIALIZEDArgobots has not been initialized
ABT_ERR_INV_XSTREAMcalled by an external thread

Definition at line 175 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_UNINITIALIZEDArgobots has not been initialized
ABT_ERR_INV_XSTREAMcalled by an external thread
ABT_ERR_INV_THREADcalled by a non-yieldable thread (tasklet)

Definition at line 150 of file self.c.