ARGOBOTS
1.1
|
This group is for Tasklet. A tasklet is a work unit that cannot yield. More...
Typedefs | |
typedef enum ABT_task_state | ABT_task_state |
Tasklet state type. More... | |
typedef struct ABT_thread_opaque * | ABT_task |
Work unit handle type. More... | |
Enumerations | |
enum | ABT_task_state { ABT_TASK_STATE_READY, ABT_TASK_STATE_RUNNING, ABT_TASK_STATE_TERMINATED } |
State of a tasklet. More... | |
Functions | |
int | ABT_task_create (ABT_pool pool, void(*task_func)(void *), void *arg, ABT_task *newtask) |
Create a new tasklet. More... | |
int | ABT_task_create_on_xstream (ABT_xstream xstream, void(*task_func)(void *), void *arg, ABT_task *newtask) |
Create a new tasklet associated with an execution stream. More... | |
int | ABT_task_revive (ABT_pool pool, void(*task_func)(void *), void *arg, ABT_task *task) |
Revive a terminated work unit. More... | |
int | ABT_task_free (ABT_task *task) |
Free a work unit. More... | |
int | ABT_task_join (ABT_task task) |
Wait for a work unit to terminate. More... | |
int | ABT_task_cancel (ABT_task task) |
Send a termination request to a work unit. More... | |
int | ABT_task_self (ABT_task *task) |
Get the calling work unit. More... | |
int | ABT_task_self_id (ABT_unit_id *id) |
Get ID of the calling work unit. More... | |
int | ABT_task_get_xstream (ABT_task task, ABT_xstream *xstream) |
Get an execution stream associated with a work unit. More... | |
int | ABT_task_get_state (ABT_task task, ABT_task_state *state) |
Get a state of a tasklet. More... | |
int | ABT_task_get_last_pool (ABT_task task, ABT_pool *pool) |
Get the last pool of a work unit. More... | |
int | ABT_task_get_last_pool_id (ABT_task task, int *id) |
Get the last pool's ID of a work unit. More... | |
int | ABT_task_set_migratable (ABT_task task, ABT_bool flag) |
Set the migratability in a work unit. More... | |
int | ABT_task_is_migratable (ABT_task task, ABT_bool *flag) |
Get the migratability of a work unit. More... | |
int | ABT_task_is_unnamed (ABT_task task, ABT_bool *flag) |
Check if a work unit is unnamed. More... | |
int | ABT_task_equal (ABT_task task1, ABT_task task2, ABT_bool *result) |
Compare two work-unit handles for equality. More... | |
int | ABT_task_get_id (ABT_task task, ABT_unit_id *task_id) |
Get ID of a work unit. More... | |
int | ABT_task_get_arg (ABT_task task, void **arg) |
Retrieve an argument for a work-unit function of a work unit. More... | |
int | ABT_task_set_specific (ABT_task task, ABT_key key, void *value) |
Set a value with a work-unit-specific key in a work unit. More... | |
int | ABT_task_get_specific (ABT_task task, ABT_key key, void **value) |
Get a value associated with a work-unit-specific key in a work unit. More... | |
This group is for Tasklet. A tasklet is a work unit that cannot yield.
typedef struct ABT_thread_opaque* ABT_task |
Work unit handle type.
This type is an alias of ABT_thread
.
A NULL handle of this type is ABT_TASK_NULL
.
ABT_THREAD_NULL
is different from that of ABT_TASK_NULL
.ABT_TASK_NULL
is an alias of ABT_THREAD_NULL
. typedef enum ABT_task_state ABT_task_state |
enum ABT_task_state |
State of a tasklet.
ABT_task_state
is replaced by ABT_thread_state
. int ABT_task_cancel | ( | ABT_task | task | ) |
Send a termination request to a work unit.
The functionality of this routine is the same as ABT_thread_cancel()
except for the error code. ABT_task_cancel()
returns ABT_ERR_INV_TASK
in a case where ABT_thread_cancel()
returns ABT_ERR_INV_THREAD
.
ABT_thread_cancel()
in the future. Create a new tasklet.
ABT_task_create()
creates a new tasklet, associates it with the pool pool
, and returns its handle through newtask
. This routine pushes the created tasklet to the pool pool
. The created tasklet calls task_func()
with arg
when it is scheduled.
If newtask
is NULL
, this routine creates an unnamed tasklet. An unnamed tasklet is automatically released on the completion of task_func()
. Otherwise, newtask
must be explicitly freed by ABT_thread_free()
.
newtask
is set to ABT_TASK_NULL
if an error occurs and newtask
is not NULL
.newtask
is not updated if an error occurs and newtask
is not NULL
. newtask
when an error occurs. ABT_SUCCESS
is returned if this routine succeeds.ABT_ERR_INV_POOL
is returned if pool
is ABT_POOL_NULL
.ABT_ERR_MEM
is returned if memory allocation fails.ABT_ERR_SYS
is returned if an error related to system calls and standard libraries occurs.ABT_ERR_UNIT
is returned if u_create_from_thread()
fails.task_func
is NULL
, the results are undefined.[in] | pool | pool handle |
[in] | task_func | function to be executed by a new tasklet |
[in] | arg | argument for task_func() |
[out] | newtask | tasklet handle |
int ABT_task_create_on_xstream | ( | ABT_xstream | xstream, |
void(*)(void *) | task_func, | ||
void * | arg, | ||
ABT_task * | newtask | ||
) |
Create a new tasklet associated with an execution stream.
ABT_task_create_on_xstream()
creates a new tasklet, associates it with the first pool of the main scheduler of the execution stream xstream
, and returns its handle through newtask
. This routine pushes the created tasklet to the pool pool
. The created tasklet calls task_func()
with arg
when it is scheduled.
If newtask
is NULL
, this routine creates an unnamed tasklet. An unnamed tasklet is automatically released on the completion of task_func()
. Otherwise, newtask
must be explicitly freed by ABT_thread_free()
.
newtask
is set to ABT_TASK_NULL
if an error occurs and newtask
is not NULL
.newtask
is not updated if an error occurs and newtask
is not NULL
. newtask
when an error occurs. ABT_SUCCESS
is returned if this routine succeeds.ABT_ERR_INV_XSTREAM
is returned if xstream
is ABT_XSTREAM_NULL
.ABT_ERR_MEM
is returned if memory allocation fails.ABT_ERR_SYS
is returned if an error related to system calls and standard libraries occurs.ABT_ERR_UNIT
is returned if u_create_from_thread()
fails.task_func
is NULL
, the results are undefined.[in] | xstream | execution stream handle |
[in] | task_func | function to be executed by a new tasklet |
[in] | arg | argument for task_func() |
[out] | newtask | tasklet handle |
Compare two work-unit handles for equality.
The functionality of this routine is the same as ABT_thread_equal()
.
int ABT_task_free | ( | ABT_task * | task | ) |
Free a work unit.
The functionality of this routine is the same as ABT_thread_free()
except for the value of task
after this routine and the error code. ABT_task_free()
sets task
to ABT_TASK_NULL
instead of ABT_THREAD_NULL
. ABT_task_free()
returns ABT_ERR_INV_TASK
in a case where ABT_thread_free()
returns ABT_ERR_INV_THREAD
.
ABT_thread_free()
in the future. int ABT_task_get_arg | ( | ABT_task | task, |
void ** | arg | ||
) |
Retrieve an argument for a work-unit function of a work unit.
The functionality of this routine is the same as ABT_thread_get_arg()
except for the error code. ABT_task_get_arg()
returns ABT_ERR_INV_TASK
in a case where ABT_thread_get_arg()
returns ABT_ERR_INV_THREAD
.
ABT_thread_get_arg()
in the future. int ABT_task_get_id | ( | ABT_task | task, |
ABT_unit_id * | task_id | ||
) |
Get ID of a work unit.
The functionality of this routine is the same as ABT_thread_get_id()
except for the error code. ABT_task_get_id()
returns ABT_ERR_INV_TASK
in a case where ABT_thread_get_id()
returns ABT_ERR_INV_THREAD
.
ABT_thread_get_id()
in the future. Get the last pool of a work unit.
The functionality of this routine is the same as ABT_thread_get_last_pool()
except for the error code. ABT_task_get_last_pool()
returns ABT_ERR_INV_TASK
in a case where ABT_thread_get_last_pool()
returns ABT_ERR_INV_THREAD
.
ABT_thread_get_last_pool()
in the future. int ABT_task_get_last_pool_id | ( | ABT_task | task, |
int * | id | ||
) |
Get the last pool's ID of a work unit.
The functionality of this routine is the same as ABT_thread_get_last_pool_id()
except for the error code. ABT_task_get_last_pool_id()
returns ABT_ERR_INV_TASK
in a case where ABT_thread_get_last_pool_id()
returns ABT_ERR_INV_THREAD
.
ABT_thread_get_last_pool_id()
in the future. Get a value associated with a work-unit-specific key in a work unit.
The functionality of this routine is the same as ABT_thread_get_specific()
.
ABT_thread_get_specific()
in the future. int ABT_task_get_state | ( | ABT_task | task, |
ABT_task_state * | state | ||
) |
Get a state of a tasklet.
ABT_task_get_state()
returns the state of the tasklet task
through state
.
Management of states of work units is performed atomically.
ABT_thread_get_state()
in the future.ABT_SUCCESS
is returned if this routine succeeds.ABT_ERR_INV_TASK
is returned if thread
is ABT_THREAD_NULL
or ABT_TASK_NULL
.ABT_ERR_INV_TASK
is returned if thread
is a ULT.state
is NULL
, the results are undefined.[in] | task | tasklet handle |
[out] | state | state of task |
int ABT_task_get_xstream | ( | ABT_task | task, |
ABT_xstream * | xstream | ||
) |
Get an execution stream associated with a work unit.
The functionality of this routine is the same as ABT_thread_get_last_xstream()
except for the error code. ABT_task_get_xstream()
returns ABT_ERR_INV_TASK
in a case where ABT_thread_get_last_xstream()
returns ABT_ERR_INV_THREAD
.
ABT_thread_get_last_xstream()
in the future. Get the migratability of a work unit.
The functionality of this routine is the same as ABT_thread_is_migratable()
except for the error code. ABT_task_is_migratable()
returns ABT_ERR_INV_TASK
in a case where ABT_thread_is_migratable()
returns ABT_ERR_INV_THREAD
.
ABT_thread_is_migratable()
in the future. Check if a work unit is unnamed.
The functionality of this routine is the same as ABT_thread_is_unnamed()
.
ABT_thread_is_unnamed()
in the future. int ABT_task_join | ( | ABT_task | task | ) |
Wait for a work unit to terminate.
The functionality of this routine is the same as ABT_thread_join()
except for the error code. ABT_task_join()
returns ABT_ERR_INV_TASK
in a case where ABT_thread_join()
returns ABT_ERR_INV_THREAD
.
ABT_thread_join()
in the future. Revive a terminated work unit.
The functionality of this routine is the same as ABT_thread_revive()
except for the error code. ABT_task_revive()
returns ABT_ERR_INV_TASK
in a case where ABT_thread_revive()
returns ABT_ERR_INV_THREAD
.
ABT_thread_revive()
in the future. int ABT_task_self | ( | ABT_task * | task | ) |
Get the calling work unit.
ABT_task_self()
returns the handle of the calling work unit through task
.
ABT_self_get_thread()
in the future.[Argobots 1.x] If a ULT calls this routine, ABT_ERR_INV_TASK
is returned.
[Argobots 2.0] A ULT may call this routine.
[Argobots 1.x] This routine returns ABT_ERR_UNINITIALIZED
if Argobots is not initialized.
[Argobots 2.0] The results of this routine are undefined if Argobots is not initialized.
[Argobots 1.x] task
is set to ABT_TASK_NULL
if an error occurs.
[Argobots 2.0] task
is not updated if an error occurs.
task
when an error occurs. ABT_SUCCESS
is returned if this routine succeeds.ABT_ERR_INV_XSTREAM
is returned if the caller is an external thread.ABT_ERR_INV_TASK
is returned if the caller is a ULT.ABT_ERR_UNINITIALIZED
is returned if the Argobots runtime is not initialized.task
is NULL
, the results are undefined.[out] | task | work unit handle |
int ABT_task_self_id | ( | ABT_unit_id * | id | ) |
Get ID of the calling work unit.
ABT_task_self_id()
returns the ID of the calling work unit through id
.
ABT_self_get_thread_id()
in the future.[Argobots 1.x] If a ULT calls this routine, ABT_ERR_INV_TASK
is returned.
[Argobots 2.0] A ULT may call this routine.
[Argobots 1.x] This routine returns ABT_ERR_UNINITIALIZED
if Argobots is not initialized.
[Argobots 2.0] The results of this routine are undefined if Argobots is not initialized.
ABT_SUCCESS
is returned if this routine succeeds.ABT_ERR_INV_XSTREAM
is returned if the caller is an external thread.ABT_ERR_INV_TASK
is returned if the caller is a ULT.ABT_ERR_UNINITIALIZED
is returned if the Argobots runtime is not initialized.id
is NULL
, the results are undefined.[out] | id | ID of the calling work unit |
Set the migratability in a work unit.
The functionality of this routine is the same as ABT_thread_set_migratable()
except for the error code. ABT_task_set_migratable()
returns ABT_ERR_INV_TASK
in a case where ABT_thread_set_migratable()
returns ABT_ERR_INV_THREAD
.
ABT_thread_set_migratable()
in the future. Set a value with a work-unit-specific key in a work unit.
The functionality of this routine is the same as ABT_thread_set_specific()
.
ABT_thread_set_specific()
in the future.