ARGOBOTS
dce6e727ffc4ca5b3ffc04cb9517c6689be51ec5
|
Go to the documentation of this file.
10 void (*task_func)(
void *),
void *arg,
11 ABTI_sched *p_sched,
int refcount,
12 ABTI_thread **pp_newtask);
59 ABTI_UB_ASSERT(ABTI_initialized());
60 ABTI_UB_ASSERT(task_func);
62 #ifndef ABT_CONFIG_ENABLE_VER_20_API
67 ABTI_global *p_global = ABTI_global_get_global();
68 ABTI_local *p_local = ABTI_local_get_local();
69 ABTI_thread *p_newtask;
70 ABTI_pool *p_pool = ABTI_pool_get_ptr(pool);
71 ABTI_CHECK_NULL_POOL_PTR(p_pool);
73 int refcount = (newtask != NULL) ? 1 : 0;
74 int abt_errno =
task_create(p_global, p_local, p_pool, task_func, arg, NULL,
75 refcount, &p_newtask);
76 ABTI_CHECK_ERROR(abt_errno);
80 *newtask = ABTI_thread_get_handle(p_newtask);
126 ABTI_UB_ASSERT(ABTI_initialized());
127 ABTI_UB_ASSERT(task_func);
129 #ifndef ABT_CONFIG_ENABLE_VER_20_API
134 ABTI_global *p_global = ABTI_global_get_global();
135 ABTI_local *p_local = ABTI_local_get_local();
136 ABTI_thread *p_newtask;
138 ABTI_xstream *p_xstream = ABTI_xstream_get_ptr(xstream);
139 ABTI_CHECK_NULL_XSTREAM_PTR(p_xstream);
142 ABTI_pool *p_pool = ABTI_xstream_get_main_pool(p_xstream);
143 int refcount = (newtask != NULL) ? 1 : 0;
144 int abt_errno =
task_create(p_global, p_local, p_pool, task_func, arg, NULL,
145 refcount, &p_newtask);
146 ABTI_CHECK_ERROR(abt_errno);
150 *newtask = ABTI_thread_get_handle(p_newtask);
190 if (!(ABTI_IS_ERROR_CHECK_ENABLED && abt_errno !=
ABT_SUCCESS)) {
269 ABTI_UB_ASSERT(task);
271 ABTI_xstream *p_local_xstream;
272 #ifndef ABT_CONFIG_ENABLE_VER_20_API
274 ABTI_SETUP_GLOBAL(NULL);
275 ABTI_SETUP_LOCAL_XSTREAM(&p_local_xstream);
276 ABTI_CHECK_TRUE(!(p_local_xstream->p_thread->type &
277 ABTI_THREAD_TYPE_YIELDABLE),
280 ABTI_UB_ASSERT(ABTI_initialized());
281 ABTI_SETUP_LOCAL_XSTREAM(&p_local_xstream);
283 *task = ABTI_thread_get_handle(p_local_xstream->p_thread);
323 ABTI_xstream *p_local_xstream;
324 #ifndef ABT_CONFIG_ENABLE_VER_20_API
325 ABTI_SETUP_GLOBAL(NULL);
326 ABTI_SETUP_LOCAL_XSTREAM(&p_local_xstream);
327 ABTI_CHECK_TRUE(!(p_local_xstream->p_thread->type &
328 ABTI_THREAD_TYPE_YIELDABLE),
331 ABTI_UB_ASSERT(ABTI_initialized());
332 ABTI_SETUP_LOCAL_XSTREAM(&p_local_xstream);
334 *
id = ABTI_thread_get_id(p_local_xstream->p_thread);
387 ABTI_UB_ASSERT(ABTI_initialized());
388 ABTI_UB_ASSERT(state);
479 #ifdef ABT_CONFIG_USE_DOXYGEN
540 #ifdef ABT_CONFIG_USE_DOXYGEN
554 #ifdef ABT_CONFIG_USE_DOXYGEN
574 void (*task_func)(
void *),
void *arg,
575 ABTI_sched *p_sched,
int refcount,
576 ABTI_thread **pp_newtask)
578 ABTI_thread *p_newtask;
581 int abt_errno = ABTI_mem_alloc_nythread(p_local, &p_newtask);
582 ABTI_CHECK_ERROR(abt_errno);
583 abt_errno = ABTI_thread_init_pool(p_global, p_newtask, p_pool);
584 if (ABTI_IS_ERROR_CHECK_ENABLED && abt_errno !=
ABT_SUCCESS) {
585 ABTI_mem_free_thread(p_global, p_local, p_newtask);
586 ABTI_HANDLE_ERROR(abt_errno);
589 p_newtask->p_last_xstream = NULL;
590 p_newtask->p_parent = NULL;
592 ABTD_atomic_relaxed_store_uint32(&p_newtask->request, 0);
593 p_newtask->f_thread = task_func;
594 p_newtask->p_arg = arg;
595 ABTD_atomic_relaxed_store_ptr(&p_newtask->p_keytable, NULL);
596 p_newtask->id = ABTI_TASK_INIT_ID;
599 ABTI_thread_type thread_type =
600 refcount ? (ABTI_THREAD_TYPE_THREAD | ABTI_THREAD_TYPE_NAMED)
601 : ABTI_THREAD_TYPE_THREAD;
602 #ifndef ABT_CONFIG_DISABLE_MIGRATION
603 thread_type |= ABTI_THREAD_TYPE_MIGRATABLE;
605 p_newtask->type |= thread_type;
607 ABTI_event_thread_create(p_local, p_newtask,
608 ABTI_local_get_xstream_or_null(p_local)
609 ? ABTI_local_get_xstream(p_local)->p_thread
617 *pp_newtask = p_newtask;
ABT_task_state
State of a tasklet.
@ ABT_THREAD_STATE_TERMINATED
struct ABT_key_opaque * ABT_key
Work-unit-specific data key handle type.
#define ABT_ERR_INV_THREAD
Error code: invalid work unit.
int ABT_thread_get_arg(ABT_thread thread, void **arg) ABT_API_PUBLIC
Retrieve an argument for a work-unit function of a work unit.
int ABT_bool
Boolean type.
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.
int ABT_task_cancel(ABT_task task)
Send a termination request to a work unit.
#define ABT_POOL_CONTEXT_OP_THREAD_CREATE
A flag that hints a push operation in a thread creation routine without a yield operation.
int ABT_task_self_id(ABT_unit_id *id)
Get ID of the calling work unit.
int ABT_task_self(ABT_task *task)
Get the calling work unit.
struct ABT_thread_opaque * ABT_task
Work unit handle type.
int ABT_task_get_last_pool_id(ABT_task task, int *id)
Get the last pool's ID of a work unit.
@ ABT_TASK_STATE_TERMINATED
int ABT_thread_set_migratable(ABT_thread thread, ABT_bool migratable) ABT_API_PUBLIC
Set the migratability in a work unit.
int ABT_thread_get_id(ABT_thread thread, ABT_unit_id *thread_id) ABT_API_PUBLIC
Get ID of a work unit.
int ABT_thread_get_state(ABT_thread thread, ABT_thread_state *state) ABT_API_PUBLIC
Get a state of a work unit.
struct ABT_pool_opaque * ABT_pool
Pool handle type.
static ABTU_ret_err int task_create(ABTI_global *p_global, ABTI_local *p_local, ABTI_pool *p_pool, void(*task_func)(void *), void *arg, ABTI_sched *p_sched, int refcount, ABTI_thread **pp_newtask)
ABT_thread_state
State of a work unit.
int ABT_thread_free(ABT_thread *thread) ABT_API_PUBLIC
Free a work unit.
int ABT_task_get_arg(ABT_task task, void **arg)
Retrieve an argument for a work-unit function of a work unit.
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.
uint64_t ABT_unit_id
Work unit ID type.
struct ABT_xstream_opaque * ABT_xstream
Execution stream handle type.
int ABT_task_is_unnamed(ABT_task task, ABT_bool *flag)
Check if a work unit is unnamed.
int ABT_thread_get_last_pool(ABT_thread thread, ABT_pool *pool) ABT_API_PUBLIC
Get the last pool of a work unit.
int ABT_thread_join(ABT_thread thread) ABT_API_PUBLIC
Wait for a work unit to terminate.
int ABT_task_revive(ABT_pool pool, void(*task_func)(void *), void *arg, ABT_task *task)
Revive a terminated work unit.
int ABT_task_free(ABT_task *task)
Free a work unit.
#define ABT_ERR_INV_TASK
Error code: invalid work unit.
#define ABT_SUCCESS
Error code: the routine returns successfully.
int ABT_thread_get_last_xstream(ABT_thread thread, ABT_xstream *xstream) ABT_API_PUBLIC
Get an execution stream associated with a work unit.
int ABT_task_get_id(ABT_task task, ABT_unit_id *task_id)
Get ID of a work unit.
int ABT_thread_is_migratable(ABT_thread thread, ABT_bool *is_migratable) ABT_API_PUBLIC
Get the migratability of a work unit.
int ABT_task_get_last_pool(ABT_task task, ABT_pool *pool)
Get the last pool of a work unit.
int ABT_task_create(ABT_pool pool, void(*task_func)(void *), void *arg, ABT_task *newtask)
Create a new tasklet.
int ABT_task_equal(ABT_task task1, ABT_task task2, ABT_bool *result)
Compare two work-unit handles for equality.
int ABT_task_get_state(ABT_task task, ABT_task_state *state)
Get a state of a tasklet.
int ABT_task_set_migratable(ABT_task task, ABT_bool flag)
Set the migratability in a work unit.
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.
int ABT_task_get_xstream(ABT_task task, ABT_xstream *xstream)
Get an execution stream associated with a work unit.
int ABT_thread_get_last_pool_id(ABT_thread thread, int *id) ABT_API_PUBLIC
Get the last pool's ID of a work unit.
int ABT_thread_revive(ABT_pool pool, void(*thread_func)(void *), void *arg, ABT_thread *thread) ABT_API_PUBLIC
Revive a terminated work unit.
int ABT_thread_equal(ABT_thread thread1, ABT_thread thread2, ABT_bool *result) ABT_API_PUBLIC
Compare two work unit handles for equality.
int ABT_task_is_migratable(ABT_task task, ABT_bool *flag)
Get the migratability of a work unit.
int ABT_thread_cancel(ABT_thread thread) ABT_API_PUBLIC
Send a cancellation request to a work unit.
int ABT_task_join(ABT_task task)
Wait for a work unit to terminate.