35 ABTI_UB_ASSERT(ABTI_initialized());
36 ABTI_UB_ASSERT(xstream);
38 ABTI_xstream *p_local_xstream;
39 ABTI_SETUP_LOCAL_XSTREAM(&p_local_xstream);
42 *xstream = ABTI_xstream_get_handle(p_local_xstream);
70 ABTI_UB_ASSERT(ABTI_initialized());
73 ABTI_xstream *p_local_xstream;
74 ABTI_SETUP_LOCAL_XSTREAM(&p_local_xstream);
76 *rank = (int)p_local_xstream->rank;
103 ABTI_UB_ASSERT(ABTI_initialized());
104 ABTI_UB_ASSERT(thread);
106 ABTI_xstream *p_local_xstream;
107 ABTI_SETUP_LOCAL_XSTREAM(&p_local_xstream);
108 *thread = ABTI_thread_get_handle(p_local_xstream->p_thread);
135 ABTI_UB_ASSERT(ABTI_initialized());
138 ABTI_xstream *p_local_xstream;
139 ABTI_SETUP_LOCAL_XSTREAM(&p_local_xstream);
140 *
id = ABTI_thread_get_id(p_local_xstream->p_thread);
144 #ifdef ABT_CONFIG_USE_DOXYGEN
154 #ifdef ABT_CONFIG_USE_DOXYGEN
193 ABTI_UB_ASSERT(ABTI_initialized());
195 ABTI_key *p_key = ABTI_key_get_ptr(key);
196 ABTI_CHECK_NULL_KEY_PTR(p_key);
198 ABTI_global *p_global;
199 ABTI_SETUP_GLOBAL(&p_global);
201 ABTI_xstream *p_local_xstream;
202 ABTI_SETUP_LOCAL_XSTREAM(&p_local_xstream);
206 ABTI_ktable_set(p_global, ABTI_xstream_get_local(p_local_xstream),
207 &p_local_xstream->p_thread->p_keytable, p_key, value);
208 ABTI_CHECK_ERROR(abt_errno);
242 ABTI_UB_ASSERT(ABTI_initialized());
243 ABTI_UB_ASSERT(value);
245 ABTI_key *p_key = ABTI_key_get_ptr(key);
246 ABTI_CHECK_NULL_KEY_PTR(p_key);
249 ABTI_xstream *p_local_xstream;
250 ABTI_SETUP_LOCAL_XSTREAM(&p_local_xstream);
253 *value = ABTI_ktable_get(&p_local_xstream->p_thread->p_keytable, p_key);
293 ABTI_UB_ASSERT(type);
295 #ifndef ABT_CONFIG_ENABLE_VER_20_API
298 ABTI_SETUP_GLOBAL(NULL);
302 ABTI_xstream *p_local_xstream =
303 ABTI_local_get_xstream_or_null(ABTI_local_get_local());
304 if (!p_local_xstream) {
307 *type = ABTI_thread_type_get_type(p_local_xstream->p_thread->type);
309 ABTI_UB_ASSERT(ABTI_initialized());
310 ABTI_xstream *p_local_xstream =
311 ABTI_local_get_xstream_or_null(ABTI_local_get_local());
312 if (p_local_xstream) {
313 *type = ABTI_thread_type_get_type(p_local_xstream->p_thread->type);
359 ABTI_UB_ASSERT(is_primary);
361 #ifndef ABT_CONFIG_ENABLE_VER_20_API
363 ABTI_SETUP_GLOBAL(NULL);
364 ABTI_ythread *p_ythread;
365 ABTI_SETUP_LOCAL_YTHREAD(NULL, &p_ythread);
366 *is_primary = (p_ythread->thread.type & ABTI_THREAD_TYPE_PRIMARY)
370 ABTI_UB_ASSERT(ABTI_initialized());
371 ABTI_xstream *p_local_xstream =
372 ABTI_local_get_xstream_or_null(ABTI_local_get_local());
373 if (p_local_xstream) {
375 (p_local_xstream->p_thread->type & ABTI_THREAD_TYPE_PRIMARY)
422 ABTI_UB_ASSERT(on_primary);
424 #ifndef ABT_CONFIG_ENABLE_VER_20_API
426 ABTI_SETUP_GLOBAL(NULL);
427 ABTI_xstream *p_local_xstream;
428 ABTI_SETUP_LOCAL_XSTREAM(&p_local_xstream);
429 *on_primary = (p_local_xstream->type == ABTI_XSTREAM_TYPE_PRIMARY)
433 ABTI_UB_ASSERT(ABTI_initialized());
434 ABTI_xstream *p_local_xstream =
435 ABTI_local_get_xstream_or_null(ABTI_local_get_local());
436 if (p_local_xstream) {
437 *on_primary = (p_local_xstream->type == ABTI_XSTREAM_TYPE_PRIMARY)
470 ABTI_UB_ASSERT(ABTI_initialized());
471 ABTI_UB_ASSERT(pool);
473 ABTI_xstream *p_local_xstream;
474 ABTI_SETUP_LOCAL_XSTREAM(&p_local_xstream);
475 ABTI_thread *p_self = p_local_xstream->p_thread;
476 ABTI_ASSERT(p_self->p_pool);
477 *pool = ABTI_pool_get_handle(p_self->p_pool);
511 ABTI_UB_ASSERT(pool_id);
513 ABTI_xstream *p_local_xstream;
514 #ifndef ABT_CONFIG_ENABLE_VER_20_API
516 ABTI_SETUP_GLOBAL(NULL);
517 ABTI_SETUP_LOCAL_XSTREAM(&p_local_xstream);
518 ABTI_thread *p_self = p_local_xstream->p_thread;
519 ABTI_ASSERT(p_self->p_pool);
520 *pool_id = p_self->p_pool->id;
522 ABTI_UB_ASSERT(ABTI_initialized());
523 ABTI_SETUP_LOCAL_XSTREAM(&p_local_xstream);
524 ABTI_thread *p_self = p_local_xstream->p_thread;
525 ABTI_ASSERT(p_self->p_pool);
526 *pool_id = p_self->p_pool->id;
558 ABTI_UB_ASSERT(ABTI_initialized());
560 ABTI_global *p_global = ABTI_global_get_global();
561 ABTI_xstream *p_local_xstream;
562 ABTI_SETUP_LOCAL_XSTREAM(&p_local_xstream);
563 ABTI_pool *p_pool = ABTI_pool_get_ptr(pool);
564 ABTI_CHECK_NULL_POOL_PTR(p_pool);
565 ABTI_thread *p_self = p_local_xstream->p_thread;
567 int abt_errno = ABTI_thread_set_associated_pool(p_global, p_self, p_pool);
568 ABTI_CHECK_ERROR(abt_errno);
595 ABTI_UB_ASSERT(ABTI_initialized());
596 ABTI_UB_ASSERT(unit);
599 ABTI_xstream *p_local_xstream;
600 ABTI_SETUP_LOCAL_XSTREAM(&p_local_xstream);
601 *unit = p_local_xstream->p_thread->unit;
628 ABTI_UB_ASSERT(ABTI_initialized());
630 ABTI_xstream *p_local_xstream;
631 ABTI_ythread *p_ythread;
632 ABTI_SETUP_LOCAL_YTHREAD(&p_local_xstream, &p_ythread);
634 ABTI_ythread_yield(&p_local_xstream, p_ythread,
675 ABTI_UB_ASSERT(ABTI_initialized());
677 ABTI_xstream *p_local_xstream;
678 ABTI_ythread *p_cur_ythread;
679 ABTI_SETUP_LOCAL_YTHREAD(&p_local_xstream, &p_cur_ythread);
681 ABTI_thread *p_tar_thread = ABTI_thread_get_ptr(thread);
682 ABTI_CHECK_NULL_THREAD_PTR(p_tar_thread);
683 ABTI_ythread *p_tar_ythread = ABTI_thread_get_ythread_or_null(p_tar_thread);
684 ABTI_CHECK_NULL_YTHREAD_PTR(p_tar_ythread);
686 ABTI_CHECK_TRUE(!(p_cur_ythread->thread.type & ABTI_THREAD_TYPE_MAIN_SCHED),
688 ABTI_CHECK_TRUE(!(p_tar_ythread->thread.type & ABTI_THREAD_TYPE_MAIN_SCHED),
692 ABTI_ythread_yield_to(&p_local_xstream, p_cur_ythread, p_tar_ythread,
693 ABTI_YTHREAD_YIELD_TO_KIND_USER,
729 ABTI_UB_ASSERT(ABTI_initialized());
731 ABTI_xstream *p_local_xstream;
732 ABTI_ythread *p_cur_ythread;
733 ABTI_SETUP_LOCAL_YTHREAD(&p_local_xstream, &p_cur_ythread);
735 ABTI_thread *p_tar_thread = ABTI_thread_get_ptr(thread);
736 ABTI_CHECK_NULL_THREAD_PTR(p_tar_thread);
737 ABTI_ythread *p_tar_ythread = ABTI_thread_get_ythread_or_null(p_tar_thread);
738 ABTI_CHECK_NULL_YTHREAD_PTR(p_tar_ythread);
739 ABTI_CHECK_TRUE(!(p_cur_ythread->thread.type & ABTI_THREAD_TYPE_MAIN_SCHED),
741 ABTI_CHECK_TRUE(!(p_tar_ythread->thread.type & ABTI_THREAD_TYPE_MAIN_SCHED),
743 ABTI_UB_ASSERT(p_cur_ythread != p_tar_ythread);
744 ABTI_UB_ASSERT(ABTD_atomic_acquire_load_int(&p_tar_ythread->thread.state) ==
748 ABTI_ythread_resume_yield_to(&p_local_xstream, p_cur_ythread, p_tar_ythread,
749 ABTI_YTHREAD_RESUME_YIELD_TO_KIND_USER,
785 ABTI_UB_ASSERT(ABTI_initialized());
787 ABTI_xstream *p_local_xstream;
788 ABTI_ythread *p_self;
789 ABTI_SETUP_LOCAL_YTHREAD(&p_local_xstream, &p_self);
833 ABTI_UB_ASSERT(ABTI_initialized());
835 ABTI_xstream *p_local_xstream;
836 ABTI_ythread *p_cur_ythread;
837 ABTI_SETUP_LOCAL_YTHREAD(&p_local_xstream, &p_cur_ythread);
839 ABTI_thread *p_tar_thread = ABTI_thread_get_ptr(thread);
840 ABTI_CHECK_NULL_THREAD_PTR(p_tar_thread);
841 ABTI_ythread *p_tar_ythread = ABTI_thread_get_ythread_or_null(p_tar_thread);
842 ABTI_CHECK_NULL_YTHREAD_PTR(p_tar_ythread);
844 ABTI_CHECK_TRUE(!(p_cur_ythread->thread.type & ABTI_THREAD_TYPE_MAIN_SCHED),
846 ABTI_CHECK_TRUE(!(p_tar_ythread->thread.type & ABTI_THREAD_TYPE_MAIN_SCHED),
850 ABTI_ythread_suspend_to(&p_local_xstream, p_cur_ythread, p_tar_ythread,
888 ABTI_UB_ASSERT(ABTI_initialized());
890 ABTI_xstream *p_local_xstream;
891 ABTI_ythread *p_cur_ythread;
892 ABTI_SETUP_LOCAL_YTHREAD(&p_local_xstream, &p_cur_ythread);
894 ABTI_thread *p_tar_thread = ABTI_thread_get_ptr(thread);
895 ABTI_CHECK_NULL_THREAD_PTR(p_tar_thread);
896 ABTI_ythread *p_tar_ythread = ABTI_thread_get_ythread_or_null(p_tar_thread);
897 ABTI_CHECK_NULL_YTHREAD_PTR(p_tar_ythread);
898 ABTI_CHECK_TRUE(!(p_cur_ythread->thread.type & ABTI_THREAD_TYPE_MAIN_SCHED),
900 ABTI_CHECK_TRUE(!(p_tar_ythread->thread.type & ABTI_THREAD_TYPE_MAIN_SCHED),
902 ABTI_UB_ASSERT(p_cur_ythread != p_tar_ythread);
903 ABTI_UB_ASSERT(ABTD_atomic_acquire_load_int(&p_tar_ythread->thread.state) ==
907 ABTI_ythread_resume_suspend_to(&p_local_xstream, p_cur_ythread,
935 ABTI_UB_ASSERT(ABTI_initialized());
937 ABTI_xstream *p_local_xstream;
938 ABTI_ythread *p_ythread;
939 ABTI_SETUP_LOCAL_YTHREAD(&p_local_xstream, &p_ythread);
940 ABTI_CHECK_TRUE(!(p_ythread->thread.type & ABTI_THREAD_TYPE_PRIMARY),
943 ABTI_ythread_exit(p_local_xstream, p_ythread);
981 ABTI_UB_ASSERT(ABTI_initialized());
983 ABTI_xstream *p_local_xstream;
984 ABTI_ythread *p_cur_ythread;
985 ABTI_SETUP_LOCAL_YTHREAD(&p_local_xstream, &p_cur_ythread);
987 ABTI_thread *p_tar_thread = ABTI_thread_get_ptr(thread);
988 ABTI_CHECK_NULL_THREAD_PTR(p_tar_thread);
989 ABTI_ythread *p_tar_ythread = ABTI_thread_get_ythread_or_null(p_tar_thread);
990 ABTI_CHECK_NULL_YTHREAD_PTR(p_tar_ythread);
992 ABTI_CHECK_TRUE(!(p_cur_ythread->thread.type & ABTI_THREAD_TYPE_MAIN_SCHED),
994 ABTI_CHECK_TRUE(!(p_tar_ythread->thread.type &
995 (ABTI_THREAD_TYPE_MAIN_SCHED | ABTI_THREAD_TYPE_PRIMARY)),
999 ABTI_ythread_exit_to(p_local_xstream, p_cur_ythread, p_tar_ythread);
1034 ABTI_UB_ASSERT(ABTI_initialized());
1036 ABTI_xstream *p_local_xstream;
1037 ABTI_ythread *p_cur_ythread;
1038 ABTI_SETUP_LOCAL_YTHREAD(&p_local_xstream, &p_cur_ythread);
1040 ABTI_thread *p_tar_thread = ABTI_thread_get_ptr(thread);
1041 ABTI_CHECK_NULL_THREAD_PTR(p_tar_thread);
1042 ABTI_ythread *p_tar_ythread = ABTI_thread_get_ythread_or_null(p_tar_thread);
1043 ABTI_CHECK_NULL_YTHREAD_PTR(p_tar_ythread);
1044 ABTI_CHECK_TRUE(!(p_cur_ythread->thread.type &
1045 (ABTI_THREAD_TYPE_PRIMARY | ABTI_THREAD_TYPE_MAIN_SCHED)),
1047 ABTI_CHECK_TRUE(!(p_tar_ythread->thread.type & ABTI_THREAD_TYPE_MAIN_SCHED),
1049 ABTI_UB_ASSERT(p_cur_ythread != p_tar_ythread);
1050 ABTI_UB_ASSERT(ABTD_atomic_acquire_load_int(&p_tar_ythread->thread.state) ==
1054 ABTI_ythread_resume_exit_to(p_local_xstream, p_cur_ythread, p_tar_ythread);
1089 ABTI_UB_ASSERT(ABTI_initialized());
1091 ABTI_thread *p_thread = ABTI_thread_get_ptr(thread);
1092 ABTI_CHECK_NULL_THREAD_PTR(p_thread);
1093 ABTI_global *p_global;
1094 ABTI_SETUP_GLOBAL(&p_global);
1096 ABTI_xstream *p_local_xstream;
1097 ABTI_SETUP_LOCAL_YTHREAD(&p_local_xstream, NULL);
1099 ABTI_pool *p_pool = ABTI_pool_get_ptr(pool);
1102 ABTI_thread_set_associated_pool(p_global, p_thread, p_pool);
1103 ABTI_CHECK_ERROR(abt_errno);
1105 ABTI_ythread_schedule(p_global, &p_local_xstream, p_thread);
1140 ABTI_xstream *p_local_xstream;
1141 #ifndef ABT_CONFIG_ENABLE_VER_20_API
1142 ABTI_SETUP_GLOBAL(NULL);
1144 ABTI_UB_ASSERT(ABTI_initialized());
1146 ABTI_SETUP_LOCAL_XSTREAM(&p_local_xstream);
1148 p_local_xstream->p_thread->p_arg = arg;
1183 ABTI_UB_ASSERT(arg);
1185 ABTI_xstream *p_local_xstream;
1186 #ifndef ABT_CONFIG_ENABLE_VER_20_API
1188 ABTI_SETUP_GLOBAL(NULL);
1190 ABTI_UB_ASSERT(ABTI_initialized());
1192 ABTI_SETUP_LOCAL_XSTREAM(&p_local_xstream);
1194 *arg = p_local_xstream->p_thread->p_arg;
1221 ABTI_UB_ASSERT(ABTI_initialized());
1222 ABTI_UB_ASSERT(thread_func);
1224 ABTI_xstream *p_local_xstream;
1225 ABTI_SETUP_LOCAL_XSTREAM(&p_local_xstream);
1227 *thread_func = p_local_xstream->p_thread->f_thread;
1256 ABTI_UB_ASSERT(ABTI_initialized());
1257 ABTI_UB_ASSERT(is_unnamed);
1259 ABTI_xstream *p_local_xstream;
1260 ABTI_SETUP_LOCAL_XSTREAM(&p_local_xstream);
1262 *is_unnamed = (p_local_xstream->p_thread->type & ABTI_THREAD_TYPE_NAMED)