29 size_t max_threads,
size_t *num_popped,
32 size_t max_threads,
size_t *num_popped,
59 ABTI_pool_required_def *p_required_def,
60 ABTI_pool_optional_def *p_optional_def,
61 ABTI_pool_deprecated_def *p_deprecated_def)
110 ABTI_pool *p_pool = ABTI_pool_get_ptr(pool);
115 ABTI_CHECK_ERROR(abt_errno);
117 access = p_pool->access;
120 ABTD_spinlock_clear(&p_data->mutex);
124 p_pool->data = p_data;
130 ABTI_pool *p_pool = ABTI_pool_get_ptr(pool);
138 ABTI_pool *p_pool = ABTI_pool_get_ptr(pool);
145 ABTI_pool *p_pool = ABTI_pool_get_ptr(pool);
154 ABTI_pool *p_pool = ABTI_pool_get_ptr(pool);
156 ABTI_thread *p_thread = ABTI_unit_get_thread_from_builtin_unit(unit);
157 ABTD_spinlock_acquire(&p_data->mutex);
159 ABTD_spinlock_release(&p_data->mutex);
166 ABTI_pool *p_pool = ABTI_pool_get_ptr(pool);
168 ABTI_thread *p_thread = ABTI_unit_get_thread_from_builtin_unit(unit);
176 ABTI_pool *p_pool = ABTI_pool_get_ptr(pool);
179 ABTD_spinlock_acquire(&p_data->mutex);
181 for (i = 0; i < num_units; i++) {
182 ABTI_thread *p_thread =
183 ABTI_unit_get_thread_from_builtin_unit(units[i]);
186 ABTD_spinlock_release(&p_data->mutex);
194 ABTI_pool *p_pool = ABTI_pool_get_ptr(pool);
197 for (i = 0; i < num_units; i++) {
198 ABTI_thread *p_thread =
199 ABTI_unit_get_thread_from_builtin_unit(units[i]);
208 ABTI_pool *p_pool = ABTI_pool_get_ptr(pool);
210 double time_start = 0.0;
213 &p_data->mutex) == 0) {
215 ABTD_spinlock_release(&p_data->mutex);
217 return ABTI_thread_get_handle(p_thread);
219 if (time_start == 0.0) {
220 time_start = ABTI_get_wtime();
222 double elapsed = ABTI_get_wtime() - time_start;
223 if (elapsed > time_secs)
227 const int sleep_nsecs = 100;
228 struct timespec ts = { 0, sleep_nsecs };
229 nanosleep(&ts, NULL);
235 ABTI_pool *p_pool = ABTI_pool_get_ptr(pool);
239 &p_data->mutex) == 0) {
241 ABTD_spinlock_release(&p_data->mutex);
243 return ABTI_unit_get_builtin_unit(p_thread);
246 const int sleep_nsecs = 100;
247 struct timespec ts = { 0, sleep_nsecs };
248 nanosleep(&ts, NULL);
250 if (ABTI_get_wtime() > abstime_secs)
258 ABTI_pool *p_pool = ABTI_pool_get_ptr(pool);
261 &p_data->mutex) == 0) {
263 ABTD_spinlock_release(&p_data->mutex);
264 return ABTI_thread_get_handle(p_thread);
273 ABTI_pool *p_pool = ABTI_pool_get_ptr(pool);
276 return ABTI_thread_get_handle(p_thread);
280 size_t max_threads,
size_t *num_popped,
284 ABTI_pool *p_pool = ABTI_pool_get_ptr(pool);
286 if (max_threads != 0 &&
288 &p_data->mutex) == 0) {
290 for (i = 0; i < max_threads; i++) {
294 threads[i] = ABTI_thread_get_handle(p_thread);
297 ABTD_spinlock_release(&p_data->mutex);
304 size_t max_threads,
size_t *num_popped,
308 ABTI_pool *p_pool = ABTI_pool_get_ptr(pool);
311 for (i = 0; i < max_threads; i++) {
315 threads[i] = ABTI_thread_get_handle(p_thread);
322 ABTI_pool *p_pool = ABTI_pool_get_ptr(pool);
324 ABTI_thread *p_thread = ABTI_unit_get_thread_from_builtin_unit(unit);
325 ABTD_spinlock_acquire(&p_data->mutex);
327 ABTD_spinlock_release(&p_data->mutex);
333 ABTI_pool *p_pool = ABTI_pool_get_ptr(pool);
335 ABTI_thread *p_thread = ABTI_unit_get_thread_from_builtin_unit(unit);
343 ABTI_pool *p_pool = ABTI_pool_get_ptr(pool);
346 access = p_pool->access;
348 ABTD_spinlock_acquire(&p_data->mutex);
352 ABTD_spinlock_release(&p_data->mutex);
360 ABTI_thread *p_thread = ABTI_unit_get_thread_from_builtin_unit(unit);
361 return ABTD_atomic_acquire_load_int(&p_thread->is_in_pool) ?
ABT_TRUE