ARGOBOTS  dce6e727ffc4ca5b3ffc04cb9517c6689be51ec5
Enumerations | Functions | Variables
thread.c File Reference
#include "abti.h"
Include dependency graph for thread.c:

Go to the source code of this file.

Enumerations

enum  thread_pool_op_kind { THREAD_POOL_OP_NONE, THREAD_POOL_OP_PUSH, THREAD_POOL_OP_INIT }
 

Functions

static ABTU_ret_err int ythread_create (ABTI_global *p_global, ABTI_local *p_local, ABTI_pool *p_pool, void(*thread_func)(void *), void *arg, ABTI_thread_attr *p_attr, ABTI_thread_type thread_type, ABTI_sched *p_sched, thread_pool_op_kind pool_op, ABTI_ythread **pp_newthread)
 
static ABTU_ret_err int thread_revive (ABTI_global *p_global, ABTI_local *p_local, ABTI_pool *p_pool, void(*thread_func)(void *), void *arg, thread_pool_op_kind pool_op, ABTI_thread *p_thread)
 
static void thread_join (ABTI_local **pp_local, ABTI_thread *p_thread)
 
static void thread_free (ABTI_global *p_global, ABTI_local *p_local, ABTI_thread *p_thread, ABT_bool free_unit)
 
static void thread_root_func (void *arg)
 
static void thread_main_sched_func (void *arg)
 
static ABTU_ret_err int thread_migrate_to_pool (ABTI_global *p_global, ABTI_local *p_local, ABTI_thread *p_thread, ABTI_pool *p_pool)
 
static ABT_unit_id thread_get_new_id (void)
 
static void thread_key_destructor_stackable_sched (void *p_value)
 
static void thread_key_destructor_migration (void *p_value)
 
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_to (ABT_pool pool, void(*thread_func)(void *), void *arg, ABT_thread_attr attr, ABT_thread *newthread)
 Create a new ULT and yield to it. 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_revive_to (ABT_pool pool, void(*thread_func)(void *), void *arg, ABT_thread *thread)
 Revive a terminated ULT and yield to it. 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...
 
ABTU_ret_err int ABTI_thread_revive (ABTI_global *p_global, ABTI_local *p_local, ABTI_pool *p_pool, void(*thread_func)(void *), void *arg, ABTI_thread *p_thread)
 
ABTU_ret_err int ABTI_ythread_create_primary (ABTI_global *p_global, ABTI_local *p_local, ABTI_xstream *p_xstream, ABTI_ythread **p_ythread)
 
ABTU_ret_err int ABTI_ythread_create_root (ABTI_global *p_global, ABTI_local *p_local, ABTI_xstream *p_xstream, ABTI_ythread **pp_root_ythread)
 
ABTU_ret_err int ABTI_ythread_create_main_sched (ABTI_global *p_global, ABTI_local *p_local, ABTI_xstream *p_xstream, ABTI_sched *p_sched)
 
ABTU_ret_err int ABTI_ythread_create_sched (ABTI_global *p_global, ABTI_local *p_local, ABTI_pool *p_pool, ABTI_sched *p_sched)
 
void ABTI_thread_join (ABTI_local **pp_local, ABTI_thread *p_thread)
 
void ABTI_thread_free (ABTI_global *p_global, ABTI_local *p_local, ABTI_thread *p_thread)
 
void ABTI_ythread_free_primary (ABTI_global *p_global, ABTI_local *p_local, ABTI_ythread *p_ythread)
 
void ABTI_ythread_free_root (ABTI_global *p_global, ABTI_local *p_local, ABTI_ythread *p_ythread)
 
ABTU_ret_err int ABTI_thread_get_mig_data (ABTI_global *p_global, ABTI_local *p_local, ABTI_thread *p_thread, ABTI_thread_mig_data **pp_mig_data)
 
void ABTI_thread_handle_request_cancel (ABTI_global *p_global, ABTI_xstream *p_local_xstream, ABTI_thread *p_thread)
 
ABTU_ret_err int ABTI_thread_handle_request_migrate (ABTI_global *p_global, ABTI_local *p_local, ABTI_thread *p_thread)
 
void ABTI_thread_print (ABTI_thread *p_thread, FILE *p_os, int indent)
 
void ABTI_thread_reset_id (void)
 
ABT_unit_id ABTI_thread_get_id (ABTI_thread *p_thread)
 
static void thread_join_busywait (ABTI_thread *p_thread)
 
static void thread_join_futexwait (ABTI_thread *p_thread)
 
static void thread_join_yield_thread (ABTI_xstream **pp_local_xstream, ABTI_ythread *p_self, ABTI_thread *p_thread)
 

Variables

static ABTI_key g_thread_sched_key
 
static ABTI_key g_thread_mig_data_key
 
static ABTD_atomic_uint64 g_thread_id
 

Enumeration Type Documentation

◆ thread_pool_op_kind

Enumerator
THREAD_POOL_OP_NONE 
THREAD_POOL_OP_PUSH 
THREAD_POOL_OP_INIT 

Definition at line 8 of file thread.c.

Function Documentation

◆ ABTI_thread_free()

void ABTI_thread_free ( ABTI_global p_global,
ABTI_local p_local,
ABTI_thread p_thread 
)

◆ ABTI_thread_get_id()

ABT_unit_id ABTI_thread_get_id ( ABTI_thread p_thread)

Definition at line 2803 of file thread.c.

Referenced by ABT_self_get_thread_id().

◆ ABTI_thread_get_mig_data()

ABTU_ret_err int ABTI_thread_get_mig_data ( ABTI_global p_global,
ABTI_local p_local,
ABTI_thread p_thread,
ABTI_thread_mig_data **  pp_mig_data 
)

◆ ABTI_thread_handle_request_cancel()

void ABTI_thread_handle_request_cancel ( ABTI_global p_global,
ABTI_xstream p_local_xstream,
ABTI_thread p_thread 
)

Definition at line 2660 of file thread.c.

Referenced by ABTI_thread_handle_request().

◆ ABTI_thread_handle_request_migrate()

ABTU_ret_err int ABTI_thread_handle_request_migrate ( ABTI_global p_global,
ABTI_local p_local,
ABTI_thread p_thread 
)

Definition at line 2674 of file thread.c.

Referenced by ABTI_thread_handle_request().

◆ ABTI_thread_join()

void ABTI_thread_join ( ABTI_local **  pp_local,
ABTI_thread p_thread 
)

Definition at line 2611 of file thread.c.

◆ ABTI_thread_print()

void ABTI_thread_print ( ABTI_thread p_thread,
FILE *  p_os,
int  indent 
)

Definition at line 2702 of file thread.c.

Referenced by ABT_info_print_thread().

◆ ABTI_thread_reset_id()

void ABTI_thread_reset_id ( void  )

Definition at line 2798 of file thread.c.

Referenced by init_library().

◆ ABTI_thread_revive()

ABTU_ret_err int ABTI_thread_revive ( ABTI_global p_global,
ABTI_local p_local,
ABTI_pool p_pool,
void(*)(void *)  thread_func,
void *  arg,
ABTI_thread p_thread 
)

Definition at line 2507 of file thread.c.

Referenced by ABT_xstream_revive().

◆ ABTI_ythread_create_main_sched()

ABTU_ret_err int ABTI_ythread_create_main_sched ( ABTI_global p_global,
ABTI_local p_local,
ABTI_xstream p_xstream,
ABTI_sched p_sched 
)

Definition at line 2573 of file thread.c.

Referenced by xstream_create().

◆ ABTI_ythread_create_primary()

ABTU_ret_err int ABTI_ythread_create_primary ( ABTI_global p_global,
ABTI_local p_local,
ABTI_xstream p_xstream,
ABTI_ythread **  p_ythread 
)

Definition at line 2520 of file thread.c.

Referenced by init_library().

◆ ABTI_ythread_create_root()

ABTU_ret_err int ABTI_ythread_create_root ( ABTI_global p_global,
ABTI_local p_local,
ABTI_xstream p_xstream,
ABTI_ythread **  pp_root_ythread 
)

Definition at line 2546 of file thread.c.

Referenced by xstream_create().

◆ ABTI_ythread_create_sched()

ABTU_ret_err int ABTI_ythread_create_sched ( ABTI_global p_global,
ABTI_local p_local,
ABTI_pool p_pool,
ABTI_sched p_sched 
)

Definition at line 2593 of file thread.c.

Referenced by ABT_pool_add_sched().

◆ ABTI_ythread_free_primary()

void ABTI_ythread_free_primary ( ABTI_global p_global,
ABTI_local p_local,
ABTI_ythread p_ythread 
)

Definition at line 2622 of file thread.c.

Referenced by finailze_library().

◆ ABTI_ythread_free_root()

void ABTI_ythread_free_root ( ABTI_global p_global,
ABTI_local p_local,
ABTI_ythread p_ythread 
)

Definition at line 2629 of file thread.c.

Referenced by xstream_create().

◆ thread_free()

static void thread_free ( ABTI_global p_global,
ABTI_local p_local,
ABTI_thread p_thread,
ABT_bool  free_unit 
)
inlinestatic

Definition at line 3037 of file thread.c.

Referenced by ABTI_thread_free(), ABTI_ythread_free_primary(), and ABTI_ythread_free_root().

◆ thread_get_new_id()

static ABT_unit_id thread_get_new_id ( void  )
inlinestatic

Definition at line 3304 of file thread.c.

Referenced by ABTI_thread_get_id().

◆ thread_join()

static void thread_join ( ABTI_local **  pp_local,
ABTI_thread p_thread 
)
inlinestatic

Definition at line 3141 of file thread.c.

◆ thread_join_busywait()

static void thread_join_busywait ( ABTI_thread p_thread)
static

Definition at line 3087 of file thread.c.

◆ thread_join_futexwait()

static void thread_join_futexwait ( ABTI_thread p_thread)
static

Definition at line 3097 of file thread.c.

◆ thread_join_yield_thread()

static void thread_join_yield_thread ( ABTI_xstream **  pp_local_xstream,
ABTI_ythread p_self,
ABTI_thread p_thread 
)
static

Definition at line 3127 of file thread.c.

◆ thread_key_destructor_migration()

static void thread_key_destructor_migration ( void *  p_value)
static

Definition at line 3081 of file thread.c.

◆ thread_key_destructor_stackable_sched()

static void thread_key_destructor_stackable_sched ( void *  p_value)
static

Definition at line 3063 of file thread.c.

◆ thread_main_sched_func()

static void thread_main_sched_func ( void *  arg)
static

Definition at line 3247 of file thread.c.

Referenced by ABTI_ythread_create_main_sched().

◆ thread_migrate_to_pool()

static ABTU_ret_err int thread_migrate_to_pool ( ABTI_global p_global,
ABTI_local p_local,
ABTI_thread p_thread,
ABTI_pool p_pool 
)
static

Definition at line 3014 of file thread.c.

◆ thread_revive()

static ABTU_ret_err int thread_revive ( ABTI_global p_global,
ABTI_local p_local,
ABTI_pool p_pool,
void(*)(void *)  thread_func,
void *  arg,
thread_pool_op_kind  pool_op,
ABTI_thread p_thread 
)
inlinestatic

Definition at line 2974 of file thread.c.

Referenced by ABT_thread_revive(), ABT_thread_revive_to(), and ABTI_thread_revive().

◆ thread_root_func()

static void thread_root_func ( void *  arg)
static

Definition at line 3208 of file thread.c.

Referenced by ABTI_ythread_create_root().

◆ ythread_create()

static ABTU_ret_err int ythread_create ( ABTI_global p_global,
ABTI_local p_local,
ABTI_pool p_pool,
void(*)(void *)  thread_func,
void *  arg,
ABTI_thread_attr p_attr,
ABTI_thread_type  thread_type,
ABTI_sched p_sched,
thread_pool_op_kind  pool_op,
ABTI_ythread **  pp_newthread 
)
inlinestatic

Variable Documentation

◆ g_thread_id

ABTD_atomic_uint64 g_thread_id
static
Initial value:

Definition at line 2796 of file thread.c.

◆ g_thread_mig_data_key

ABTI_key g_thread_mig_data_key
static

◆ g_thread_sched_key

ABTI_key g_thread_sched_key
static
ABTI_KEY_STATIC_INITIALIZER
#define ABTI_KEY_STATIC_INITIALIZER(f_destructor, id)
Definition: abti_key.h:42
ABTI_KEY_ID_STACKABLE_SCHED
#define ABTI_KEY_ID_STACKABLE_SCHED
Definition: abti_key.h:47
thread_key_destructor_migration
static void thread_key_destructor_migration(void *p_value)
Definition: thread.c:3081
ABTD_ATOMIC_UINT64_STATIC_INITIALIZER
#define ABTD_ATOMIC_UINT64_STATIC_INITIALIZER(val)
Definition: abtd_atomic.h:67
thread_key_destructor_stackable_sched
static void thread_key_destructor_stackable_sched(void *p_value)
Definition: thread.c:3063
ABTI_KEY_ID_MIGRATION
#define ABTI_KEY_ID_MIGRATION
Definition: abti_key.h:48