|
ARGOBOTS
1.1
|
This group is for User-level Thread (ULT). A ULT is a work unit that can yield. More...
Typedefs | |
| typedef struct ABT_thread_opaque * | ABT_thread |
| Work unit handle type. More... | |
| typedef struct ABT_thread_attr_opaque * | ABT_thread_attr |
| ULT attribute handle type. More... | |
| typedef enum ABT_thread_state | ABT_thread_state |
| Work unit state type. More... | |
| typedef ABT_unit_id | ABT_thread_id |
| Work unit ID type. More... | |
Enumerations | |
| enum | ABT_thread_state { ABT_THREAD_STATE_READY, ABT_THREAD_STATE_RUNNING, ABT_THREAD_STATE_BLOCKED, ABT_THREAD_STATE_TERMINATED } |
| State of a work unit. More... | |
Functions | |
| int | ABT_thread_create (ABT_pool pool, void(*thread_func)(void *), void *arg, ABT_thread_attr attr, ABT_thread *newthread) |
| Create a new ULT. More... | |
| int | ABT_thread_create_on_xstream (ABT_xstream xstream, void(*thread_func)(void *), void *arg, ABT_thread_attr attr, ABT_thread *newthread) |
| Create a new ULT associated with an execution stream. More... | |
| int | ABT_thread_create_many (int num_threads, ABT_pool *pool_list, void(**thread_func_list)(void *), void **arg_list, ABT_thread_attr attr, ABT_thread *newthread_list) |
| Create a set of new ULTs. More... | |
| int | ABT_thread_revive (ABT_pool pool, void(*thread_func)(void *), void *arg, ABT_thread *thread) |
| Revive a terminated work unit. More... | |
| int | ABT_thread_free (ABT_thread *thread) |
| Free a work unit. More... | |
| int | ABT_thread_free_many (int num_threads, ABT_thread *thread_list) |
| Free a set of work units. More... | |
| int | ABT_thread_join (ABT_thread thread) |
| Wait for a work unit to terminate. More... | |
| int | ABT_thread_join_many (int num_threads, ABT_thread *thread_list) |
| Wait for a set of work units to terminate. More... | |
| int | ABT_thread_exit (void) |
| Terminate a calling ULT. More... | |
| int | ABT_thread_cancel (ABT_thread thread) |
| Send a cancellation request to a work unit. More... | |
| int | ABT_thread_self (ABT_thread *thread) |
| Get the calling work unit. More... | |
| int | ABT_thread_self_id (ABT_unit_id *id) |
| Get ID of the calling work unit. More... | |
| int | ABT_thread_get_last_xstream (ABT_thread thread, ABT_xstream *xstream) |
| Get an execution stream associated with a work unit. More... | |
| int | ABT_thread_get_state (ABT_thread thread, ABT_thread_state *state) |
| Get a state of a work unit. More... | |
| int | ABT_thread_get_last_pool (ABT_thread thread, ABT_pool *pool) |
| Get the last pool of a work unit. More... | |
| int | ABT_thread_get_last_pool_id (ABT_thread thread, int *id) |
| Get the last pool's ID of a work unit. More... | |
| int | ABT_thread_get_unit (ABT_thread thread, ABT_unit *unit) |
| Get a unit handle of the target work unit. More... | |
| int | ABT_thread_set_associated_pool (ABT_thread thread, ABT_pool pool) |
| Set an associated pool for the target work unit. More... | |
| int | ABT_thread_yield_to (ABT_thread thread) |
| Yield the calling ULT to another ULT. More... | |
| int | ABT_thread_yield (void) |
| Yield the calling ULT to its parent ULT. More... | |
| int | ABT_thread_resume (ABT_thread thread) |
| Resume a ULT. More... | |
| int | ABT_thread_migrate_to_xstream (ABT_thread thread, ABT_xstream xstream) |
| Request a migration of a work unit to a specific execution stream. More... | |
| int | ABT_thread_migrate_to_sched (ABT_thread thread, ABT_sched sched) |
| Request a migration of a work unit to a specific scheduler. More... | |
| int | ABT_thread_migrate_to_pool (ABT_thread thread, ABT_pool pool) |
| Request a migration of a work unit to a specific pool. More... | |
| int | ABT_thread_migrate (ABT_thread thread) |
| Request a migration of a work unit to any available execution stream. More... | |
| int | ABT_thread_set_callback (ABT_thread thread, void(*cb_func)(ABT_thread thread, void *cb_arg), void *cb_arg) |
| Register a callback function in a work unit. More... | |
| int | ABT_thread_set_migratable (ABT_thread thread, ABT_bool migratable) |
| Set the migratability in a work unit. More... | |
| int | ABT_thread_is_migratable (ABT_thread thread, ABT_bool *is_migratable) |
| Get the migratability of a work unit. More... | |
| int | ABT_thread_is_primary (ABT_thread thread, ABT_bool *is_primary) |
| Check if a work unit is the primary ULT. More... | |
| int | ABT_thread_is_unnamed (ABT_thread thread, ABT_bool *is_unnamed) |
| Check if a work unit is unnamed. More... | |
| int | ABT_thread_equal (ABT_thread thread1, ABT_thread thread2, ABT_bool *result) |
| Compare two work unit handles for equality. More... | |
| int | ABT_thread_get_stacksize (ABT_thread thread, size_t *stacksize) |
| Get a stack size of a work unit. More... | |
| int | ABT_thread_get_id (ABT_thread thread, ABT_unit_id *thread_id) |
| Get ID of a work unit. More... | |
| int | ABT_thread_set_arg (ABT_thread thread, void *arg) |
| Set an argument for a work-unit function of a work unit. More... | |
| int | ABT_thread_get_arg (ABT_thread thread, void **arg) |
| Retrieve an argument for a work-unit function of a work unit. More... | |
| int | ABT_thread_get_thread_func (ABT_thread thread, void(**thread_func)(void *)) |
| Retrieve a work-unit function of a work unit. More... | |
| int | ABT_thread_set_specific (ABT_thread thread, ABT_key key, void *value) |
| Set a value with a work-unit-specific data key in a work unit. More... | |
| int | ABT_thread_get_specific (ABT_thread thread, ABT_key key, void **value) |
| Get a value associated with a work-unit-specific data key in a work unit. More... | |
| int | ABT_thread_get_attr (ABT_thread thread, ABT_thread_attr *attr) |
| Get attributes of a work unit. More... | |
This group is for User-level Thread (ULT). A ULT is a work unit that can yield.
| typedef struct ABT_thread_opaque* ABT_thread |
Work unit handle type.
A NULL handle of this type is ABT_THREAD_NULL.
ABT_THREAD_NULL is different from that of ABT_TASK_NULL.ABT_TASK_NULL is an alias of ABT_THREAD_NULL. | typedef struct ABT_thread_attr_opaque* ABT_thread_attr |
| typedef ABT_unit_id ABT_thread_id |
| typedef enum ABT_thread_state ABT_thread_state |
| enum ABT_thread_state |
| int ABT_thread_cancel | ( | ABT_thread | thread | ) |
Send a cancellation request to a work unit.
ABT_thread_cancel() sends a cancellation request to the work unit thread. thread may terminate before its thread function completes.
Requests for work units are updated atomically.
thread.thread. ABT_SUCCESS is returned if this routine succeeds.ABT_ERR_INV_THREAD is returned if thread is ABT_THREAD_NULL or ABT_TASK_NULL.ABT_ERR_INV_THREAD is returned if the caller is the primary ULT.ABT_ERR_FEATURE_NA is returned if the cancellation feature is not supported.thread is not running, the results are undefined.| [in] | thread | work unit handle |
| int ABT_thread_create | ( | ABT_pool | pool, |
| void(*)(void *) | thread_func, | ||
| void * | arg, | ||
| ABT_thread_attr | attr, | ||
| ABT_thread * | newthread | ||
| ) |
Create a new ULT.
ABT_thread_create() creates a new ULT, given by the attributes attr, associates it with the pool pool, and returns its handle through newthread. This routine pushes the created ULT to pool. The created ULT calls thread_func() with arg when it is scheduled.
attr can be created by ABT_thread_attr_create(). If the user passes ABT_THREAD_ATTR_NULL for attr, the default ULT attribute is used.
ABT_thread_attr_create().This routine copies attr, so the user can free attr after this routine returns.
If newthread is NULL, this routine creates an unnamed ULT. An unnamed ULT is automatically released on the completion of thread_func(). Otherwise, newthread must be explicitly freed by ABT_thread_free().
newthread is set to ABT_THREAD_NULL if an error occurs and newthread is not NULL.newthread is not updated if an error occurs and newthread is not NULL. newthread 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.thread_func is NULL, the results are undefined.| [in] | pool | pool handle |
| [in] | thread_func | function to be executed by a new ULT |
| [in] | arg | argument for thread_func() |
| [in] | attr | ULT attribute |
| [out] | newthread | ULT handle |
| int ABT_thread_create_many | ( | int | num_threads, |
| ABT_pool * | pool_list, | ||
| void(**)(void *) | thread_func_list, | ||
| void ** | arg_list, | ||
| ABT_thread_attr | attr, | ||
| ABT_thread * | newthread_list | ||
| ) |
Create a set of new ULTs.
ABT_thread_create_many() creates a set of new ULTs, i.e., num_threads ULTs, having the same ULT attribute attr and returns ULT handles through newthread_list. Each newly created ULT calls the corresponding function of thread_func_list that has num_threads ULT functions with the corresponding argument of arg_list that has num_threads argument pointers an argument. Each newly created ULT is pushed to the corresponding pool of pool_list that has num_threads of pools handles. That is, the i th ULT is pushed to i th pool of pool_list and, when scheduled, calls the i th function of thread_func_list with the i th argument of arg_list. This routine pushes newly created ULTs to pools pool.
attr can be created by ABT_thread_attr_create(). If the user passes ABT_THREAD_ATTR_NULL for attr, the default ULT attribute is used.
ABT_thread_attr_create().If newthread_list is NULL, this routine creates unnamed ULTs. An unnamed ULT is automatically released on the completion of thread_func(). Otherwise, the creates ULTs must be explicitly freed by ABT_thread_free().
This routine is deprecated because this routine does not provide a way for the user to keep track of an error that happens during this routine. The user should call ABT_thread_create() multiple times instead.
ABT_SUCCESS is returned if this routine succeeds.| [in] | num_threads | number of array elements |
| [in] | pool_list | array of pool handles |
| [in] | thread_func_list | array of ULT functions |
| [in] | arg_list | array of arguments for each ULT function |
| [in] | attr | ULT attribute |
| [out] | newthread_list | array of ULT handles |
| int ABT_thread_create_on_xstream | ( | ABT_xstream | xstream, |
| void(*)(void *) | thread_func, | ||
| void * | arg, | ||
| ABT_thread_attr | attr, | ||
| ABT_thread * | newthread | ||
| ) |
Create a new ULT associated with an execution stream.
ABT_thread_create_on_xstream() creates a new ULT, given by the attributes attr, associates it with the first pool of the main scheduler of the execution stream xstream, and returns its handle through newthread. This routine pushes the created ULT to the pool pool. The created ULT calls thread_func() with arg when it is scheduled.
attr can be created by ABT_thread_attr_create(). If the user passes ABT_THREAD_ATTR_NULL for attr, the default ULT attribute is used.
ABT_thread_attr_create().This routine copies attr, so the user can free attr after this routine returns.
If newthread is NULL, this routine creates an unnamed ULT. An unnamed ULT is automatically released on the completion of thread_func(). Otherwise, newthread must be explicitly freed by ABT_thread_free().
newthread is set to ABT_THREAD_NULL if an error occurs and newthread is not NULL.newthread is not updated if an error occurs and newthread is not NULL. newthread 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.thread_func is NULL, the results are undefined.| [in] | xstream | execution stream handle |
| [in] | thread_func | function to be executed by a new ULT |
| [in] | arg | argument for thread_func() |
| [in] | attr | ULT attribute |
| [out] | newthread | ULT handle |
| int ABT_thread_equal | ( | ABT_thread | thread1, |
| ABT_thread | thread2, | ||
| ABT_bool * | result | ||
| ) |
Compare two work unit handles for equality.
ABT_thread_equal() compares two work unit handles thread1 and thread2 for equality.
This routine is deprecated since its behavior is the same as comparing values of ABT_thread handles except for handling ABT_THREAD_NULL and ABT_TASK_NULL.
thread1 or thread2.thread1 or thread2. ABT_SUCCESS is returned if this routine succeeds.result is NULL, the results are undefined.| [in] | thread1 | work unit handle 1 |
| [in] | thread2 | work unit handle 2 |
| [out] | result | result (ABT_TRUE: same, ABT_FALSE: not same) |
| int ABT_thread_exit | ( | void | ) |
Terminate a calling ULT.
ABT_thread_exit() terminates the calling ULT. This routine does not return if it succeeds.
ABT_self_exit() in the future.ABT_ERR_UNINITIALIZED if Argobots is not initialized.ABT_ERR_INV_XSTREAM is returned if the caller is an external thread.ABT_ERR_INV_THREAD is returned if the caller is a tasklet.ABT_ERR_INV_THREAD is returned if the caller is the primary ULT.ABT_ERR_UNINITIALIZED is returned if the Argobots runtime is not initialized.| int ABT_thread_free | ( | ABT_thread * | thread | ) |
Free a work unit.
ABT_thread_free() deallocates the resource used for the work unit thread and sets thread to ABT_THREAD_NULL. If thread is still running, this routine will be blocked on thread until thread terminates.
thread.thread. ABT_SUCCESS is returned if this routine succeeds.ABT_ERR_INV_THREAD is returned if thread points to ABT_THREAD_NULL or ABT_TASK_NULL.ABT_ERR_INV_THREAD is returned if thread is the caller.ABT_ERR_INV_THREAD is returned if thread is the primary ULT.ABT_ERR_INV_THREAD is returned if thread is the work unit of the main scheduler.thread is NULL, the results are undefined.thread is blocked on by a caller of ABT_thread_join() or ABT_thread_free(), the results are undefined.thread is accessed after calling this routine, the results are undefined.| [in,out] | thread | work unit handle |
| int ABT_thread_free_many | ( | int | num_threads, |
| ABT_thread * | thread_list | ||
| ) |
Free a set of work units.
ABT_thread_free_many() deallocates a set of work units listed in thread_list that has num_threads work unit handles. If any of work units is still running, this routine will be blocked on the running work unit until it terminates. Each handle referenced by thread_list is set to ABT_THRAED_NULL.
This routine is deprecated because this routine does not provide a way for the user to keep track of an error that happens during this routine. The user should call ABT_thread_free() multiple times instead.
Management of states of work units is performed atomically.
thread_list.thread_list. ABT_SUCCESS is returned if this routine succeeds.| [in] | num_threads | the number of array elements |
| [in,out] | thread_list | array of work unit handles |
| int ABT_thread_get_arg | ( | ABT_thread | thread, |
| void ** | arg | ||
| ) |
Retrieve an argument for a work-unit function of a work unit.
ABT_thread_get_arg() returns the argument for the work-unit function of the work unit thread through arg.
thread.thread. ABT_SUCCESS is returned if this routine succeeds.ABT_ERR_INV_THREAD is returned if thread is ABT_THREAD_NULL or ABT_TASK_NULL.arg is NULL, the results are undefined.| [in] | thread | work unit handle |
| [out] | arg | argument for the work-unit function |
| int ABT_thread_get_attr | ( | ABT_thread | thread, |
| ABT_thread_attr * | attr | ||
| ) |
Get attributes of a work unit.
ABT_thread_get_attr() returns a newly created attribute object that is copied from the attributes of the work unit thread through attr. Attribute values of attr may be different from those used on the creation of thread. Since this routine allocates a ULT attribute object, it is the user's responsibility to free attr after its use.
thread is a tasklet, this routine returns ABT_ERR_INV_THREAD.thread is a tasklet, this routine sets attr to a properly translated ULT attributes and returns ABT_SUCCESS. ABT_SUCCESS is returned if this routine succeeds.ABT_ERR_INV_THREAD is returned if thread is ABT_THREAD_NULL or ABT_TASK_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_INV_THREAD is returned if thread is a tasklet.attr is NULL, the results are undefined.| [in] | thread | work unit handle |
| [out] | attr | ULT attributes |
| int ABT_thread_get_id | ( | ABT_thread | thread, |
| ABT_unit_id * | thread_id | ||
| ) |
Get ID of a work unit.
ABT_thread_get_id() returns the ID of the work unit thread through thread_id.
thread.thread. ABT_SUCCESS is returned if this routine succeeds.ABT_ERR_INV_THREAD is returned if thread is ABT_THREAD_NULL or ABT_TASK_NULL.thread_id is NULL, the results are undefined.| [in] | thread | work unit handle |
| [out] | thread_id | work unit ID |
| int ABT_thread_get_last_pool | ( | ABT_thread | thread, |
| ABT_pool * | pool | ||
| ) |
Get the last pool of a work unit.
ABT_thread_get_last_pool() returns the last pool associated with the work unit thread through pool. If thread is not associated with any pool, pool is set to ABT_POOL_NULL.
pool may point to an invalid handle if the last pool associated with thread has already been freed.thread.thread. ABT_SUCCESS is returned if this routine succeeds.ABT_ERR_INV_THREAD is returned if thread is ABT_THREAD_NULL or ABT_TASK_NULL.pool is NULL, the results are undefined.| [in] | thread | work unit handle |
| [out] | pool | the last pool associated with thread |
| int ABT_thread_get_last_pool_id | ( | ABT_thread | thread, |
| int * | id | ||
| ) |
Get the last pool's ID of a work unit.
ABT_thread_get_last_pool_id() returns the ID of the last pool associated with the work unit thread through id.
pool may point to an invalid handle if the last pool associated with thread has already been freed.thread.thread. ABT_SUCCESS is returned if this routine succeeds.ABT_ERR_INV_THREAD is returned if thread is ABT_THREAD_NULL or ABT_TASK_NULL.id is NULL, the results are undefined.thread has already been freed, the results are undefined.| [in] | thread | work unit handle |
| [out] | id | ID of the last pool associated with thread |
| int ABT_thread_get_last_xstream | ( | ABT_thread | thread, |
| ABT_xstream * | xstream | ||
| ) |
Get an execution stream associated with a work unit.
ABT_thread_get_last_xstream() returns the last execution stream associated with the work unit thread through xstream. If thread is not associated with any execution stream, xstream is set to ABT_XSTREAM_NULL.
xstream may point to an invalid handle if the last execution stream associated with thread has already been freed.ABT_SUCCESS is returned if this routine succeeds.ABT_ERR_INV_THREAD is returned if thread is ABT_THREAD_NULL or ABT_TASK_NULL.xstream is NULL, the results are undefined.| [in] | thread | work unit handle |
| [out] | xstream | execution stream handle |
| int ABT_thread_get_specific | ( | ABT_thread | thread, |
| ABT_key | key, | ||
| void ** | value | ||
| ) |
Get a value associated with a work-unit-specific data key in a work unit.
ABT_thread_get_specific() returns the value associated with the work-unit-specific data key key in the work unit thread through value. If thread has never set a value for key, this routine sets value to NULL.
Work-unit-specific values associated with a work-unit-specific data key are read and updated atomically.
ABT_SUCCESS is returned if this routine succeeds.ABT_ERR_INV_THREAD is returned if thread is ABT_THREAD_NULL or ABT_TASK_NULL.ABT_ERR_INV_KEY is returned if key is ABT_KEY_NULL.value is NULL, the results are undefined.| [in] | thread | work unit handle |
| [in] | key | work-unit-specific data key handle |
| [out] | value | value |
| int ABT_thread_get_stacksize | ( | ABT_thread | thread, |
| size_t * | stacksize | ||
| ) |
Get a stack size of a work unit.
ABT_thread_get_stacksize() returns the stack size of the work unit thread in bytes through stacksize. If thread does not have a stack managed by the Argobots runtime (e.g., a tasklet or the primary ULT), stacksize is set to 0.
thread.thread. ABT_SUCCESS is returned if this routine succeeds.ABT_ERR_INV_THREAD is returned if thread is ABT_THREAD_NULL or ABT_TASK_NULL.stacksize is NULL, the results are undefined.| [in] | thread | work unit handle |
| [out] | stacksize | stack size in bytes |
| int ABT_thread_get_state | ( | ABT_thread | thread, |
| ABT_thread_state * | state | ||
| ) |
Get a state of a work unit.
ABT_thread_get_state() returns the state of the work unit thread through state.
Management of states of work units is performed atomically.
thread.thread. thread is a tasklet, ABT_task_state is converted to the corresponding ABT_thread_state.ABT_SUCCESS is returned if this routine succeeds.ABT_ERR_INV_THREAD is returned if thread is ABT_THREAD_NULL or ABT_TASK_NULL.state is NULL, the results are undefined.| [in] | thread | work unit handle |
| [out] | state | state of thread |
| int ABT_thread_get_thread_func | ( | ABT_thread | thread, |
| void(**)(void *) | thread_func | ||
| ) |
Retrieve a work-unit function of a work unit.
ABT_thread_get_thread_func() returns the work-unit function of the work unit thread through thread_func.
ABT_SUCCESS is returned if this routine succeeds.ABT_ERR_INV_THREAD is returned if thread is ABT_THREAD_NULL or ABT_TASK_NULL.thread_func is NULL, the results are undefined.| [in] | thread | work unit handle |
| [out] | thread_func | work-unit function |
| int ABT_thread_get_unit | ( | ABT_thread | thread, |
| ABT_unit * | unit | ||
| ) |
Get a unit handle of the target work unit.
ABT_thread_get_unit() returns the ABT_unit handle associated with the work unit thread through unit.
ABT_SUCCESS is returned if this routine succeeds.ABT_ERR_INV_THREAD is returned if thread is ABT_THREAD_NULL or ABT_TASK_NULL.unit is NULL, the results are undefined.| [in] | thread | work unit handle |
| [out] | unit | work unit handle |
| int ABT_thread_is_migratable | ( | ABT_thread | thread, |
| ABT_bool * | is_migratable | ||
| ) |
Get the migratability of a work unit.
ABT_thread_is_migratable() returns the migratability of the work unit thread through is_migratable. If thread is migratable, is_migratable is set to ABT_TRUE. Otherwise, is_migratable is set to ABT_FALSE.
thread.thread. ABT_SUCCESS is returned if this routine succeeds.ABT_ERR_INV_THREAD is returned if thread is ABT_THREAD_NULL or ABT_TASK_NULL.ABT_ERR_FEATURE_NA is returned if the migration feature is not supported.is_migratable is NULL, the results are undefined.| [in] | thread | work unit handle |
| [out] | is_migratable | result (ABT_TRUE: migratable, ABT_FALSE: not) |
| int ABT_thread_is_primary | ( | ABT_thread | thread, |
| ABT_bool * | is_primary | ||
| ) |
Check if a work unit is the primary ULT.
ABT_thread_is_primary() checks if the work unit thread is the primary ULT and returns the result through is_primary. If thread is the main ULT, is_primary is set to ABT_TRUE. Otherwise, is_primary is set to ABT_FALSE.
thread.thread. ABT_SUCCESS is returned if this routine succeeds.ABT_ERR_INV_THREAD is returned if thread is ABT_THREAD_NULL or ABT_TASK_NULL.flag is NULL, the results are undefined.| [in] | thread | work unit handle |
| [out] | is_primary | result (ABT_TRUE: primary ULT, ABT_FALSE: not) |
| int ABT_thread_is_unnamed | ( | ABT_thread | thread, |
| ABT_bool * | is_unnamed | ||
| ) |
Check if a work unit is unnamed.
ABT_thread_is_primary() checks if the work unit thread is unnamed and returns the result through is_unnamed. If thread is unnamed, is_unnamed is set to ABT_TRUE. Otherwise, is_unnamed is set to ABT_FALSE.
ABT_self_get_thread() on an unnamed work unit.ABT_SUCCESS is returned if this routine succeeds.ABT_ERR_INV_THREAD is returned if thread is ABT_THREAD_NULL or ABT_TASK_NULL.is_unnamed is NULL, the results are undefined.| [in] | thread | work unit handle |
| [out] | is_unnamed | result (ABT_TRUE: unnamed, ABT_FALSE: not) |
| int ABT_thread_join | ( | ABT_thread | thread | ) |
Wait for a work unit to terminate.
The caller of ABT_thread_join() waits for the work unit thread until thread terminates.
Management of states of work units is performed atomically.
thread.thread. ABT_SUCCESS is returned if this routine succeeds.ABT_ERR_INV_THREAD is returned if thread is ABT_THREAD_NULL or ABT_TASK_NULL.ABT_ERR_INV_THREAD is returned if thread is the caller.ABT_ERR_INV_THREAD is returned if thread is the primary ULT.ABT_ERR_INV_THREAD is returned if thread is the work unit of the main scheduler.thread is blocked on by a caller of ABT_thread_join() or ABT_thread_free(), the results are undefined.thread is accessed concurrently, the results are undefined.| [in] | thread | work unit handle |
| int ABT_thread_join_many | ( | int | num_threads, |
| ABT_thread * | thread_list | ||
| ) |
Wait for a set of work units to terminate.
The caller of ABT_thread_join_many() waits for all the work units in thread_list that has num_threads work unit handles until all the work units in thread_list terminate.
This routine is deprecated because this routine does not provide a way for the user to keep track of an error that happens during this routine. The user should call ABT_thread_join() multiple times instead.
Management of states of work units is performed atomically.
thread_list.thread_list. ABT_SUCCESS is returned if this routine succeeds.| [in] | num_threads | the number of ULTs to join |
| [in] | thread_list | array of target ULT handles |
| int ABT_thread_migrate | ( | ABT_thread | thread | ) |
Request a migration of a work unit to any available execution stream.
ABT_thread_migrate() requests a migration of the work unit thread to one of the execution streams. The last execution stream of thread is not chosen as the target execution stream. The previous migration request will be overwritten by the new migration request. The requested work unit may be migrated before its work-unit function completes.
Requests for work units are updated atomically.
It is the user's responsibility to keep all the execution streams, the main schedulers, and their associated pools alive until the migration process completes or thread is freed, whichever is earlier.
This routine is deprecated because this routine is significantly restrictive. The user should use other migration functions instead.
[Argobots 1.0] The user cannot pass a tasklet handle as thread.
[Argobots 1.1] This routine accepts a tasklet handle as thread.
[Argobots 1.0] ABT_ERR_INV_THREAD is returned if the runtime finds that thread is terminated.
[Argobots 1.1] The results of this routine are undefined if thread is terminated.
ABT_SUCCESS is returned if this routine succeeds.ABT_ERR_INV_THREAD is returned if thread is ABT_THREAD_NULL or ABT_TASK_NULL.ABT_ERR_INV_THREAD is returned if thread is not migratable.ABT_ERR_INV_THREAD is returned if thread is the work unit of the main scheduler.ABT_ERR_MIGRATION_NA is returned if no execution stream for migration exists.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_FEATURE_NA is returned if the migration feature is not supported.thread is freed, whichever is earlier, the results are undefined.thread is terminated, the results are undefined.| [in] | thread | work unit handle |
| int ABT_thread_migrate_to_pool | ( | ABT_thread | thread, |
| ABT_pool | pool | ||
| ) |
Request a migration of a work unit to a specific pool.
ABT_thread_migrate_to_pool() requests a migration of the work unit thread to the pool pool. The previous migration request will be overwritten by the new migration request. The requested work unit may be migrated before its work-unit function completes.
Requests for work units are updated atomically.
It is the user's responsibility to keep pool alive until the migration process completes or thread is freed, whichever is earlier.
[Argobots 1.0] The user cannot pass a tasklet handle as thread.
[Argobots 1.1] This routine accepts a tasklet handle as thread.
[Argobots 1.0] ABT_ERR_INV_THREAD is returned if the runtime finds that thread is terminated.
[Argobots 1.1] The results of this routine are undefined if thread is terminated.
ABT_SUCCESS is returned if this routine succeeds.ABT_ERR_INV_THREAD is returned if thread is ABT_THREAD_NULL or ABT_TASK_NULL.ABT_ERR_INV_THREAD is returned if thread is not migratable.ABT_ERR_INV_THREAD is returned if thread is the work unit of the main scheduler.ABT_ERR_INV_POOL is returned if pool is ABT_POOL_NULL.ABT_ERR_MIGRATION_TARGET is returned if thread is associated with pool.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_FEATURE_NA is returned if the migration feature is not supported.pool is freed before the migration process completes or thread is freed, whichever is earlier, the results are undefined.thread is terminated, the results are undefined.| [in] | thread | work unit handle |
| [in] | pool | pool handle |
| int ABT_thread_migrate_to_sched | ( | ABT_thread | thread, |
| ABT_sched | sched | ||
| ) |
Request a migration of a work unit to a specific scheduler.
ABT_thread_migrate_to_sched() requests a migration of the work unit thread to any pool associated with the scheduler sched. The previous migration request is overwritten by the new migration request. The requested work unit may be migrated before its work-unit function completes.
Requests for work units are updated atomically.
It is the user's responsibility to keep sched and its associated pools alive until the migration process completes or thread is freed, whichever is earlier.
[Argobots 1.0] The user cannot pass a tasklet handle as thread.
[Argobots 1.1] This routine accepts a tasklet handle as thread.
[Argobots 1.0] ABT_ERR_INV_THREAD is returned if the runtime finds that thread is terminated.
[Argobots 1.1] The results of this routine are undefined if thread is terminated.
ABT_SUCCESS is returned if this routine succeeds.ABT_ERR_INV_THREAD is returned if thread is ABT_THREAD_NULL or ABT_TASK_NULL.ABT_ERR_INV_THREAD is returned if thread is not migratable.ABT_ERR_INV_THREAD is returned if thread is the work unit of the main scheduler.ABT_ERR_INV_SCHED is returned if sched is ABT_SCHED_NULL.ABT_ERR_MIGRATION_TARGET is returned if thread is associated with any pool associated with sched.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_FEATURE_NA is returned if the migration feature is not supported.sched or any pool associated with sched is freed before the migration process completes or thread is freed, whichever is earlier, the results are undefined.thread is terminated, the results are undefined.| [in] | thread | work unit handle |
| [in] | sched | scheduler handle |
| int ABT_thread_migrate_to_xstream | ( | ABT_thread | thread, |
| ABT_xstream | xstream | ||
| ) |
Request a migration of a work unit to a specific execution stream.
ABT_thread_migrate_to_xstream() requests a migration of the work unit thread to any pool associated with the main scheduler of execution stream xstream. The previous migration request is overwritten by the new migration request. The requested work unit may be migrated before its work-unit function completes.
Requests for work units are updated atomically.
It is the user's responsibility to keep xstream, its main scheduler, and its associated pools alive until the migration process completes or thread is freed, whichever is earlier.
[Argobots 1.0] The user cannot pass a tasklet handle as thread.
[Argobots 1.1] This routine accepts a tasklet handle as thread.
[Argobots 1.0] ABT_ERR_INV_THREAD is returned if the runtime finds that thread is terminated.
[Argobots 1.1] The results of this routine are undefined if thread is terminated.
ABT_SUCCESS is returned if this routine succeeds.ABT_ERR_INV_THREAD is returned if thread is ABT_THREAD_NULL or ABT_TASK_NULL.ABT_ERR_INV_THREAD is returned if thread is not migratable.ABT_ERR_INV_THREAD is returned if thread is the work unit of the main scheduler.ABT_ERR_INV_XSTREAM is returned if xstream is ABT_XSTREAM_NULL.ABT_ERR_MIGRATION_TARGET is returned if thread is associated with any pool associated with the main scheduler of xstream.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_FEATURE_NA is returned if the migration feature is not supported.xstream, the main scheduler of xstream, or any pool associated with the main scheduler of xstream is freed before the migration process completes or thread is freed, whichever is earlier, the results are undefined.thread is terminated, the results are undefined.| [in] | thread | work unit handle |
| [in] | xstream | execution stream handle |
| int ABT_thread_resume | ( | ABT_thread | thread | ) |
Resume a ULT.
ABT_thread_resume() resumes the ULT thread blocked by ABT_self_suspend() by making thread ready and pushing thread to its associated pool.
ABT_ERR_THREAD is returned if thread is not suspended.thread is not suspended. thread has been suspended. Note that Argobots 1.x does not perform this check atomically, so the user may not concurrently call ABT_thread_resume() for the same ULT. ABT_SUCCESS is returned if this routine succeeds.ABT_ERR_INV_THREAD is returned if thread is ABT_THREAD_NULL or ABT_TASK_NULL.ABT_ERR_INV_THREAD is returned if thread is a tasklet.ABT_ERR_THREAD is returned if thread is not suspended.thread is accessed concurrently, the results are undefined.thread is not suspended, the results are undefined.| [in] | thread | ULT handle |
| int ABT_thread_revive | ( | ABT_pool | pool, |
| void(*)(void *) | thread_func, | ||
| void * | arg, | ||
| ABT_thread * | thread | ||
| ) |
Revive a terminated work unit.
ABT_thread_revive() revives the work unit thread with the new work-unit function thread_func() and its argument arg. This routine does not change the attributes of thread. The revived work unit is pushed to the pool pool.
Although this routine takes a pointer of ABT_thread, the handle of thread is not updated by this routine.
thread must be a terminated work unit that has not been freed. A work unit that is blocked on by another caller may not be revived.
Management of states of work units is performed atomically.
thread.thread. ABT_SUCCESS is returned if this routine succeeds.ABT_ERR_INV_POOL is returned if pool is ABT_POOL_NULL.ABT_ERR_INV_THREAD is returned if thread points to ABT_THREAD_NULL or ABT_TASK_NULL.ABT_ERR_INV_THREAD is returned if thread is not terminated.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.thread_func is NULL, the results are undefined.thread is NULL, the results are undefined.thread is blocked on by a caller of ABT_thread_free(), the results are undefined.thread is accessed concurrently, the results are undefined.| [in] | pool | pool handle |
| [in] | thread_func | function to be executed by the work unit |
| [in] | arg | argument for thread_func() |
| [in,out] | thread | work unit handle |
Definition at line 358 of file thread.c.
Referenced by ABT_task_revive().
| int ABT_thread_self | ( | ABT_thread * | thread | ) |
Get the calling work unit.
ABT_thread_self() returns the handle of the calling work unit through thread.
ABT_self_get_thread() in the future.[Argobots 1.x] If a tasklet calls this routine, ABT_ERR_INV_THREAD is returned.
[Argobots 2.0] A tasklet 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] thread is set to ABT_THREAD_NULL if an error occurs.
[Argobots 2.0] thread is not updated if an error occurs.
thread 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_THREAD is returned if the caller is a tasklet.ABT_ERR_UNINITIALIZED is returned if the Argobots runtime is not initialized.thread is NULL, the results are undefined.| [out] | thread | work unit handle |
| int ABT_thread_self_id | ( | ABT_unit_id * | id | ) |
Get ID of the calling work unit.
ABT_thread_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 tasklet calls this routine, ABT_ERR_INV_THREAD is returned.
[Argobots 2.0] A tasklet 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_THREAD is returned if the caller is a tasklet.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 |
| int ABT_thread_set_arg | ( | ABT_thread | thread, |
| void * | arg | ||
| ) |
Set an argument for a work-unit function of a work unit.
ABT_thread_set_arg() sets the argument arg for the work-unit function of the work unit thread.
thread.thread. ABT_SUCCESS is returned if this routine succeeds.ABT_ERR_INV_THREAD is returned if thread is ABT_THREAD_NULL or ABT_TASK_NULL.thread is accessed concurrently, the results are undefined.| [in] | thread | work unit handle |
| [in] | arg | argument for the work-unit function |
| int ABT_thread_set_associated_pool | ( | ABT_thread | thread, |
| ABT_pool | pool | ||
| ) |
Set an associated pool for the target work unit.
ABT_thread_set_associated_pool() changes the associated pool of the work unit thread to the pool pool. This routine must be called after thread is popped from its original associated pool (i.e., thread must not be in any pool), which is the pool where thread was residing. This routine does not push thread to pool.
thread.thread. ABT_SUCCESS is returned if this routine succeeds.ABT_ERR_INV_THREAD is returned if thread is ABT_THREAD_NULL or ABT_TASK_NULL.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.thread is in a pool, the results are undefined.thread is accessed concurrently, the results are undefined.| [in] | thread | work unit handle |
| [in] | pool | pool handle |
| int ABT_thread_set_callback | ( | ABT_thread | thread, |
| void(*)(ABT_thread thread, void *cb_arg) | cb_func, | ||
| void * | cb_arg | ||
| ) |
Register a callback function in a work unit.
ABT_thread_set_callback() registers the callback function cb_func() and its argument cb_arg in the work unit thread. If cb_func is not NULL, cb_func() is called when thread is migrated. The first argument of cb_func() is the handle of a migrated work unit. The second argument is cb_arg passed to this routine. The caller of the callback function is undefined, so a program that relies on the caller is non-conforming. If cb_func is NULL, this routine unregisters a callback function in thread.
thread.thread. ABT_SUCCESS is returned if this routine succeeds.ABT_ERR_INV_THREAD is returned if thread is ABT_THREAD_NULL or ABT_TASK_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_FEATURE_NA is returned if the migration feature is not supported.cb_func(), the results are undefined.thread is accessed concurrently, the results are undefined.| [in] | thread | work unit handle |
| [in] | cb_func | callback function |
| [in] | cb_arg | argument for cb_func() |
| int ABT_thread_set_migratable | ( | ABT_thread | thread, |
| ABT_bool | migratable | ||
| ) |
Set the migratability in a work unit.
ABT_thread_set_migratable() sets the migratability in the work unit thread. If migratable is ABT_TRUE, thread becomes migratable. Otherwise, thread becomes unmigratable.
thread.thread. thread is the primary ULT or the work unit associated with the main scheduler, this routine has no effect and returns ABT_SUCCESS.thread is the primary ULT or the work unit associated with the main scheduler, this routine returns ABT_ERR_INV_THREAD. ABT_SUCCESS. ABT_SUCCESS is returned if this routine succeeds.ABT_ERR_INV_THREAD is returned if thread is ABT_THREAD_NULL or ABT_TASK_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_FEATURE_NA is returned if the migration feature is not supported.ABT_ERR_INV_THREAD is returned if thread is the primary ULT.ABT_ERR_INV_THREAD is returned if thread is the work unit of the main scheduler.migratable is neither ABT_TRUE nor ABT_FALSE, the results are undefined.thread is accessed concurrently, the results are undefined.| [in] | thread | work unit handle |
| [in] | migratable | migratability flag (ABT_TRUE: migratable, ABT_FALSE: not) |
| int ABT_thread_set_specific | ( | ABT_thread | thread, |
| ABT_key | key, | ||
| void * | value | ||
| ) |
Set a value with a work-unit-specific data key in a work unit.
ABT_thread_set_specific() associates the value value with the work-unit-specific data key key in the work unit thread.
Work-unit-specific values associated with a work-unit-specific data key are read and updated atomically.
ABT_SUCCESS is returned if this routine succeeds.ABT_ERR_INV_THREAD is returned if thread is ABT_THREAD_NULL or ABT_TASK_NULL.ABT_ERR_INV_KEY is returned if key is ABT_KEY_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.| [in] | thread | work unit handle |
| [in] | key | work-unit-specific data key handle |
| [in] | value | value |
| int ABT_thread_yield | ( | void | ) |
Yield the calling ULT to its parent ULT.
ABT_thread_yield() yields the calling ULT and pushes the calling ULT to its associated pool. Its parent ULT will be resumed.
ABT_self_yield() in the future.[Argobots 1.x] This routine returns ABT_SUCCESS without any effect if a tasklet calls this routine.
[Argobots 2.0] This routine returns ABT_ERR_INV_THREAD if a tasklet calls this routine.
[Argobots 1.x] This routine returns ABT_SUCCESS without any effect if an external thread calls this routine.
[Argobots 2.0] This routine returns ABT_ERR_INV_XSTREAM if an external thread calls this routine.
ABT_SUCCESS is returned if this routine succeeds.ABT_ERR_INV_THREAD is returned if the caller is a tasklet.ABT_ERR_INV_XSTREAM is returned if the caller is an external thread.| int ABT_thread_yield_to | ( | ABT_thread | thread | ) |
Yield the calling ULT to another ULT.
ABT_thread_yield_to() yields the calling ULT and schedules the ULT thread that is in its associated pool. The calling ULT will be pushed to its associated pool.
[Argobots 1.x] This routine returns ABT_SUCCESS without any effect if a tasklet calls this routine.
[Argobots 2.0] This routine returns ABT_ERR_INV_THREAD if a tasklet calls this routine.
[Argobots 1.x] This routine returns ABT_SUCCESS without any effect if an external thread calls this routine.
[Argobots 2.0] This routine returns ABT_ERR_INV_XSTREAM if an external thread calls this routine.
ABT_SUCCESS is returned if this routine succeeds.ABT_ERR_INV_THREAD is returned if thread is ABT_THREAD_NULL or ABT_TASK_NULL.ABT_ERR_INV_THREAD is returned if thread is a tasklet.ABT_ERR_INV_THREAD is returned if the caller is the work unit of the main scheduler.ABT_ERR_INV_THREAD is returned if thread is the caller.ABT_ERR_POOL is returned if a pool associated with thread does not support functions that are necessary for this routine.ABT_ERR_INV_THREAD is returned if the caller is a tasklet.ABT_ERR_INV_XSTREAM is returned if the caller is an external thread.thread is accessed concurrently, the results are undefined.thread is not in thread, the results are undefined.thread is not ready, the results are undefined.| [in] | thread | handle to the target thread |
1.8.17