ARGOBOTS  66b1c39742507d8df30e8d28c54839b961a14814
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
unit.c
Go to the documentation of this file.
1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
2 /*
3  * See COPYRIGHT in top-level directory.
4  */
5 
6 #include "abti.h"
7 
28 {
29  ABTI_pool *p_pool = ABTI_pool_get_ptr(pool);
30  ABTI_CHECK_NULL_POOL_PTR(p_pool);
31 
32  ABTI_unit_set_associated_pool(unit, p_pool);
33  return ABT_SUCCESS;
34 }
35 
36 /*****************************************************************************/
37 /* Private APIs */
38 /*****************************************************************************/
39 
40 void ABTI_unit_set_associated_pool(ABT_unit unit, ABTI_pool *p_pool)
41 {
42  ABT_unit_type type = p_pool->u_get_type(unit);
43 
44  if (type == ABT_UNIT_TYPE_THREAD) {
45  ABT_thread thread = p_pool->u_get_thread(unit);
46  ABTI_ythread *p_thread = ABTI_ythread_get_ptr(thread);
47  p_thread->thread.p_pool = p_pool;
48 
49  } else {
50  ABTI_ASSERT(type == ABT_UNIT_TYPE_TASK);
51  ABT_task task = p_pool->u_get_task(unit);
52  ABTI_thread *p_task = ABTI_thread_get_ptr(task);
53  p_task->p_pool = p_pool;
54  }
55 }
struct ABT_unit_opaque * ABT_unit
Definition: abt.h:337
struct ABT_thread_opaque * ABT_task
Definition: abt.h:353
struct ABT_pool_opaque * ABT_pool
Definition: abt.h:329
struct ABT_thread_opaque * ABT_thread
Definition: abt.h:343
#define ABT_SUCCESS
Definition: abt.h:64
ABT_unit_type
Definition: abt.h:169
int ABT_unit_set_associated_pool(ABT_unit unit, ABT_pool pool) ABT_API_PUBLIC
Set the associated pool for the target work unit.
Definition: unit.c:27