ARGOBOTS
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  int abt_errno = ABT_SUCCESS;
30 
31  ABTI_pool *p_pool = ABTI_pool_get_ptr(pool);
32  ABTI_CHECK_NULL_POOL_PTR(p_pool);
33 
34  ABTI_unit_set_associated_pool(unit, p_pool);
35 
36 fn_exit:
37  return abt_errno;
38 
39 fn_fail:
40  HANDLE_ERROR_FUNC_WITH_CODE(abt_errno);
41  goto fn_exit;
42 }
43 
44 /*****************************************************************************/
45 /* Private APIs */
46 /*****************************************************************************/
47 
48 void ABTI_unit_set_associated_pool(ABT_unit unit, ABTI_pool *p_pool)
49 {
50  ABT_unit_type type = p_pool->u_get_type(unit);
51 
52  if (type == ABT_UNIT_TYPE_THREAD) {
53  ABT_thread thread = p_pool->u_get_thread(unit);
54  ABTI_thread *p_thread = ABTI_thread_get_ptr(thread);
55  p_thread->p_pool = p_pool;
56 
57  } else {
58  ABTI_ASSERT(type == ABT_UNIT_TYPE_TASK);
59  ABT_task task = p_pool->u_get_task(unit);
60  ABTI_task *p_task = ABTI_task_get_ptr(task);
61  p_task->p_pool = p_pool;
62  }
63 }
struct ABT_unit_opaque * ABT_unit
Definition: abt.h:275
struct ABT_task_opaque * ABT_task
Definition: abt.h:289
struct ABT_pool_opaque * ABT_pool
Definition: abt.h:267
struct ABT_thread_opaque * ABT_thread
Definition: abt.h:279
#define HANDLE_ERROR_FUNC_WITH_CODE(n)
Definition: abti_error.h:241
#define ABT_SUCCESS
Definition: abt.h:64
ABT_unit_type
Definition: abt.h:170
int ABT_unit_set_associated_pool(ABT_unit unit, ABT_pool pool)
Set the associated pool for the target work unit.
Definition: unit.c:27