ARGOBOTS
task.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 
8 static int ABTI_task_create(ABTI_local *p_local, ABTI_pool *p_pool,
9  void (*task_func)(void *), void *arg,
10  ABTI_sched *p_sched, int refcount,
11  ABTI_task **pp_newtask);
12 static int ABTI_task_revive(ABTI_local *p_local, ABTI_pool *p_pool,
13  void (*task_func)(void *), void *arg,
14  ABTI_task *p_task);
15 static inline uint64_t ABTI_task_get_new_id(void);
16 
44 int ABT_task_create(ABT_pool pool, void (*task_func)(void *), void *arg,
45  ABT_task *newtask)
46 {
47  int abt_errno = ABT_SUCCESS;
48  ABTI_local *p_local = ABTI_local_get_local();
49  ABTI_task *p_newtask;
50  ABTI_pool *p_pool = ABTI_pool_get_ptr(pool);
51  ABTI_CHECK_NULL_POOL_PTR(p_pool);
52 
53  int refcount = (newtask != NULL) ? 1 : 0;
54  abt_errno = ABTI_task_create(p_local, p_pool, task_func, arg, NULL,
55  refcount, &p_newtask);
56  ABTI_CHECK_ERROR(abt_errno);
57 
58  /* Return value */
59  if (newtask) {
60  *newtask = ABTI_task_get_handle(p_newtask);
61  }
62 
63 fn_exit:
64  return abt_errno;
65 
66 fn_fail:
67  if (newtask)
68  *newtask = ABT_TASK_NULL;
69  HANDLE_ERROR_FUNC_WITH_CODE(abt_errno);
70  goto fn_exit;
71 }
72 
73 /* This routine is to create a tasklet for the scheduler. */
74 int ABTI_task_create_sched(ABTI_local *p_local, ABTI_pool *p_pool,
75  ABTI_sched *p_sched)
76 {
77  int abt_errno = ABT_SUCCESS;
78  ABTI_task *p_newtask;
79 
80  void *arg = (void *)ABTI_sched_get_handle(p_sched);
81  /* If p_sched is reused, ABTI_task_revive() can be used. */
82  if (p_sched->p_task) {
83  abt_errno =
84  ABTI_task_revive(p_local, p_pool, (void (*)(void *))p_sched->run,
85  arg, p_sched->p_task);
86  ABTI_CHECK_ERROR(abt_errno);
87  goto fn_exit;
88  }
89 
90  /* Allocate a task object */
91  abt_errno =
92  ABTI_task_create(p_local, p_pool, (void (*)(void *))p_sched->run, arg,
93  p_sched, 1, &p_newtask);
94  ABTI_CHECK_ERROR(abt_errno);
95 
96 fn_exit:
97  return abt_errno;
98 
99 fn_fail:
100  HANDLE_ERROR_FUNC_WITH_CODE(abt_errno);
101  goto fn_exit;
102 }
103 
135 int ABT_task_create_on_xstream(ABT_xstream xstream, void (*task_func)(void *),
136  void *arg, ABT_task *newtask)
137 {
138  int abt_errno = ABT_SUCCESS;
139  ABTI_local *p_local = ABTI_local_get_local();
140  ABTI_task *p_newtask;
141 
142  ABTI_xstream *p_xstream = ABTI_xstream_get_ptr(xstream);
143  ABTI_CHECK_NULL_XSTREAM_PTR(p_xstream);
144 
145  /* TODO: need to consider the access type of target pool */
146  ABTI_pool *p_pool = ABTI_xstream_get_main_pool(p_xstream);
147  int refcount = (newtask != NULL) ? 1 : 0;
148  abt_errno = ABTI_task_create(p_local, p_pool, task_func, arg, NULL,
149  refcount, &p_newtask);
150  ABTI_CHECK_ERROR(abt_errno);
151 
152  /* Return value */
153  if (newtask)
154  *newtask = ABTI_task_get_handle(p_newtask);
155 
156 fn_exit:
157  return abt_errno;
158 
159 fn_fail:
160  if (newtask)
161  *newtask = ABT_TASK_NULL;
162  HANDLE_ERROR_FUNC_WITH_CODE(abt_errno);
163  goto fn_exit;
164 }
165 
184 int ABT_task_revive(ABT_pool pool, void (*task_func)(void *), void *arg,
185  ABT_task *task)
186 {
187  int abt_errno = ABT_SUCCESS;
188  ABTI_local *p_local = ABTI_local_get_local();
189 
190  ABTI_task *p_task = ABTI_task_get_ptr(*task);
191  ABTI_CHECK_NULL_TASK_PTR(p_task);
192 
193  ABTI_pool *p_pool = ABTI_pool_get_ptr(pool);
194  ABTI_CHECK_NULL_POOL_PTR(p_pool);
195 
196  abt_errno = ABTI_task_revive(p_local, p_pool, task_func, arg, p_task);
197  ABTI_CHECK_ERROR(abt_errno);
198 
199 fn_exit:
200  return abt_errno;
201 
202 fn_fail:
203  HANDLE_ERROR_FUNC_WITH_CODE(abt_errno);
204  goto fn_exit;
205 }
206 
221 {
222  int abt_errno = ABT_SUCCESS;
223  ABTI_local *p_local = ABTI_local_get_local();
224  ABT_task h_task = *task;
225  ABTI_task *p_task = ABTI_task_get_ptr(h_task);
226  ABTI_CHECK_NULL_TASK_PTR(p_task);
227 
228  /* Wait until the task terminates */
229  while (ABTD_atomic_acquire_load_int(&p_task->state) !=
231 #ifndef ABT_CONFIG_DISABLE_EXT_THREAD
232  if (ABTI_self_get_type(p_local) != ABT_UNIT_TYPE_THREAD) {
233  ABTD_atomic_pause();
234  continue;
235  }
236 #endif
237  ABTI_thread_yield(&p_local, p_local->p_thread);
238  }
239 
240  /* Free the ABTI_task structure */
241  ABTI_task_free(p_local, p_task);
242 
243  /* Return value */
244  *task = ABT_TASK_NULL;
245 
246 fn_exit:
247  return abt_errno;
248 
249 fn_fail:
250  HANDLE_ERROR_FUNC_WITH_CODE(abt_errno);
251  goto fn_exit;
252 }
253 
267 {
268  int abt_errno = ABT_SUCCESS;
269  ABTI_local *p_local = ABTI_local_get_local();
270 
271  ABTI_task *p_task = ABTI_task_get_ptr(task);
272  ABTI_CHECK_NULL_TASK_PTR(p_task);
273 
274  /* TODO: better implementation */
275  while (ABTD_atomic_acquire_load_int(&p_task->state) !=
277 #ifndef ABT_CONFIG_DISABLE_EXT_THREAD
278  if (ABTI_self_get_type(p_local) != ABT_UNIT_TYPE_THREAD) {
279  ABTD_atomic_pause();
280  continue;
281  }
282 #endif
283  ABTI_thread_yield(&p_local, p_local->p_thread);
284  }
285 
286 fn_exit:
287  return abt_errno;
288 
289 fn_fail:
290  HANDLE_ERROR_FUNC_WITH_CODE(abt_errno);
291  goto fn_exit;
292 }
293 
303 {
304 #ifdef ABT_CONFIG_DISABLE_TASK_CANCEL
305  return ABT_ERR_FEATURE_NA;
306 #else
307  int abt_errno = ABT_SUCCESS;
308  ABTI_task *p_task = ABTI_task_get_ptr(task);
309  ABTI_CHECK_NULL_TASK_PTR(p_task);
310 
311  /* Set the cancel request */
312  ABTI_task_set_request(p_task, ABTI_TASK_REQ_CANCEL);
313 
314 fn_exit:
315  return abt_errno;
316 
317 fn_fail:
318  HANDLE_ERROR_FUNC_WITH_CODE(abt_errno);
319  goto fn_exit;
320 #endif
321 }
322 
338 {
339  int abt_errno = ABT_SUCCESS;
340  ABTI_local *p_local = ABTI_local_get_local();
341 
342 #ifndef ABT_CONFIG_DISABLE_EXT_THREAD
343  /* In case that Argobots has not been initialized or this routine is called
344  * by an external thread, e.g., pthread, return an error code instead of
345  * making the call fail. */
346  if (gp_ABTI_global == NULL) {
347  abt_errno = ABT_ERR_UNINITIALIZED;
348  *task = ABT_TASK_NULL;
349  return abt_errno;
350  }
351  if (p_local == NULL) {
352  abt_errno = ABT_ERR_INV_XSTREAM;
353  *task = ABT_TASK_NULL;
354  return abt_errno;
355  }
356 #endif
357 
358  ABTI_task *p_task = p_local->p_task;
359  if (p_task != NULL) {
360  *task = ABTI_task_get_handle(p_task);
361  } else {
362  abt_errno = ABT_ERR_INV_TASK;
363  *task = ABT_TASK_NULL;
364  }
365 
366  return abt_errno;
367 }
368 
382 int ABT_task_self_id(uint64_t *id)
383 {
384  int abt_errno = ABT_SUCCESS;
385  ABTI_local *p_local = ABTI_local_get_local();
386 
387 #ifndef ABT_CONFIG_DISABLE_EXT_THREAD
388  /* In case that Argobots has not been initialized or this routine is called
389  * by an external thread, e.g., pthread, return an error code instead of
390  * making the call fail. */
391  if (gp_ABTI_global == NULL) {
392  abt_errno = ABT_ERR_UNINITIALIZED;
393  return abt_errno;
394  }
395  if (p_local == NULL) {
396  abt_errno = ABT_ERR_INV_XSTREAM;
397  return abt_errno;
398  }
399 #endif
400 
401  ABTI_task *p_task = p_local->p_task;
402  if (p_task != NULL) {
403  *id = ABTI_task_get_id(p_task);
404  } else {
405  abt_errno = ABT_ERR_INV_TASK;
406  }
407 
408  return abt_errno;
409 }
410 
425 {
426  int abt_errno = ABT_SUCCESS;
427  ABTI_task *p_task = ABTI_task_get_ptr(task);
428  ABTI_CHECK_NULL_TASK_PTR(p_task);
429 
430  /* Return value */
431  *xstream = ABTI_xstream_get_handle(p_task->p_xstream);
432 
433 fn_exit:
434  return abt_errno;
435 
436 fn_fail:
437  HANDLE_ERROR_FUNC_WITH_CODE(abt_errno);
438  goto fn_exit;
439 }
440 
451 {
452  int abt_errno = ABT_SUCCESS;
453 
454  ABTI_task *p_task = ABTI_task_get_ptr(task);
455  ABTI_CHECK_NULL_TASK_PTR(p_task);
456 
457  /* Return value */
458  *state = (ABT_task_state)ABTD_atomic_acquire_load_int(&p_task->state);
459 
460 fn_exit:
461  return abt_errno;
462 
463 fn_fail:
464  HANDLE_ERROR_FUNC_WITH_CODE(abt_errno);
465  goto fn_exit;
466 }
467 
481 {
482  int abt_errno = ABT_SUCCESS;
483 
484  ABTI_task *p_task = ABTI_task_get_ptr(task);
485  ABTI_CHECK_NULL_TASK_PTR(p_task);
486 
487  /* Return value */
488  *pool = ABTI_pool_get_handle(p_task->p_pool);
489 
490 fn_exit:
491  return abt_errno;
492 
493 fn_fail:
494  HANDLE_ERROR_FUNC_WITH_CODE(abt_errno);
495  goto fn_exit;
496 }
497 
513 {
514  int abt_errno = ABT_SUCCESS;
515 
516  ABTI_task *p_task = ABTI_task_get_ptr(task);
517  ABTI_CHECK_NULL_TASK_PTR(p_task);
518 
519  ABTI_ASSERT(p_task->p_pool);
520  *id = (int)(p_task->p_pool->id);
521 
522 fn_exit:
523  return abt_errno;
524 
525 fn_fail:
526  HANDLE_ERROR_FUNC_WITH_CODE(abt_errno);
527  goto fn_exit;
528 }
529 
547 {
548 #ifndef ABT_CONFIG_DISABLE_MIGRATION
549  int abt_errno = ABT_SUCCESS;
550  ABTI_task *p_task = ABTI_task_get_ptr(task);
551  ABTI_CHECK_NULL_TASK_PTR(p_task);
552 
553  p_task->migratable = flag;
554 
555 fn_exit:
556  return abt_errno;
557 
558 fn_fail:
559  HANDLE_ERROR_FUNC_WITH_CODE(abt_errno);
560  goto fn_exit;
561 #else
562  return ABT_ERR_MIGRATION_NA;
563 #endif
564 }
565 
581 {
582 #ifndef ABT_CONFIG_DISABLE_MIGRATION
583  int abt_errno = ABT_SUCCESS;
584  ABTI_task *p_task = ABTI_task_get_ptr(task);
585  ABTI_CHECK_NULL_TASK_PTR(p_task);
586 
587  *flag = p_task->migratable;
588 
589 fn_exit:
590  return abt_errno;
591 
592 fn_fail:
593  HANDLE_ERROR_FUNC_WITH_CODE(abt_errno);
594  goto fn_exit;
595 #else
596  return ABT_ERR_MIGRATION_NA;
597 #endif
598 }
599 
615 int ABT_task_equal(ABT_task task1, ABT_task task2, ABT_bool *result)
616 {
617  ABTI_task *p_task1 = ABTI_task_get_ptr(task1);
618  ABTI_task *p_task2 = ABTI_task_get_ptr(task2);
619  *result = (p_task1 == p_task2) ? ABT_TRUE : ABT_FALSE;
620  return ABT_SUCCESS;
621 }
622 
634 int ABT_task_get_id(ABT_task task, uint64_t *task_id)
635 {
636  int abt_errno = ABT_SUCCESS;
637 
638  ABTI_task *p_task = ABTI_task_get_ptr(task);
639  ABTI_CHECK_NULL_TASK_PTR(p_task);
640 
641  *task_id = ABTI_task_get_id(p_task);
642 
643 fn_exit:
644  return abt_errno;
645 
646 fn_fail:
647  HANDLE_ERROR_FUNC_WITH_CODE(abt_errno);
648  goto fn_exit;
649 }
650 
663 int ABT_task_get_arg(ABT_task task, void **arg)
664 {
665  int abt_errno = ABT_SUCCESS;
666 
667  ABTI_task *p_task = ABTI_task_get_ptr(task);
668  ABTI_CHECK_NULL_TASK_PTR(p_task);
669 
670  *arg = p_task->p_arg;
671 
672 fn_exit:
673  return abt_errno;
674 
675 fn_fail:
676  HANDLE_ERROR_FUNC_WITH_CODE(abt_errno);
677  goto fn_exit;
678 }
679 
680 /*****************************************************************************/
681 /* Private APIs */
682 /*****************************************************************************/
683 
684 static int ABTI_task_create(ABTI_local *p_local, ABTI_pool *p_pool,
685  void (*task_func)(void *), void *arg,
686  ABTI_sched *p_sched, int refcount,
687  ABTI_task **pp_newtask)
688 {
689  int abt_errno = ABT_SUCCESS;
690  ABTI_task *p_newtask;
691  ABT_task h_newtask;
692  ABTI_CHECK_NULL_POOL_PTR(p_pool);
693 
694  /* Allocate a task object */
695  p_newtask = ABTI_mem_alloc_task(p_local);
696 
697  p_newtask->p_xstream = NULL;
698  ABTD_atomic_relaxed_store_int(&p_newtask->state, ABT_TASK_STATE_READY);
699  ABTD_atomic_relaxed_store_uint32(&p_newtask->request, 0);
700  p_newtask->f_task = task_func;
701  p_newtask->p_arg = arg;
702 #ifndef ABT_CONFIG_DISABLE_STACKABLE_SCHED
703  p_newtask->is_sched = p_sched;
704 #endif
705  p_newtask->p_pool = p_pool;
706  p_newtask->refcount = refcount;
707  p_newtask->p_keytable = NULL;
708 #ifndef ABT_CONFIG_DISABLE_MIGRATION
709  p_newtask->migratable = ABT_TRUE;
710 #endif
711  p_newtask->id = ABTI_TASK_INIT_ID;
712 
713  /* Create a wrapper work unit */
714  h_newtask = ABTI_task_get_handle(p_newtask);
715  p_newtask->unit = p_pool->u_create_from_task(h_newtask);
716 
717  LOG_EVENT("[T%" PRIu64 "] created\n", ABTI_task_get_id(p_newtask));
718 
719  /* Add this task to the scheduler's pool */
720 #ifdef ABT_CONFIG_DISABLE_POOL_PRODUCER_CHECK
721  ABTI_pool_push(p_pool, p_newtask->unit);
722 #else
723  abt_errno = ABTI_pool_push(p_pool, p_newtask->unit,
724  ABTI_self_get_native_thread_id(p_local));
725  if (abt_errno != ABT_SUCCESS) {
726  ABTI_task_free(p_local, p_newtask);
727  goto fn_fail;
728  }
729 #endif
730 
731  /* Return value */
732  *pp_newtask = p_newtask;
733 
734 fn_exit:
735  return abt_errno;
736 
737 fn_fail:
738  HANDLE_ERROR_FUNC_WITH_CODE(abt_errno);
739  goto fn_exit;
740 }
741 
742 static int ABTI_task_revive(ABTI_local *p_local, ABTI_pool *p_pool,
743  void (*task_func)(void *), void *arg,
744  ABTI_task *p_task)
745 {
746  int abt_errno = ABT_SUCCESS;
747 
748  ABTI_CHECK_TRUE(ABTD_atomic_relaxed_load_int(&p_task->state) ==
751 
752  p_task->p_xstream = NULL;
753  ABTD_atomic_relaxed_store_int(&p_task->state, ABT_TASK_STATE_READY);
754  ABTD_atomic_relaxed_store_uint32(&p_task->request, 0);
755  p_task->f_task = task_func;
756  p_task->p_arg = arg;
757  p_task->refcount = 1;
758  p_task->p_keytable = NULL;
759 
760  if (p_task->p_pool != p_pool) {
761  /* Free the unit for the old pool */
762  p_task->p_pool->u_free(&p_task->unit);
763 
764  /* Set the new pool */
765  p_task->p_pool = p_pool;
766 
767  /* Create a wrapper work unit */
768  ABT_task task = ABTI_task_get_handle(p_task);
769  p_task->unit = p_pool->u_create_from_task(task);
770  }
771 
772  LOG_EVENT("[T%" PRIu64 "] revived\n", ABTI_task_get_id(p_task));
773 
774  /* Add this task to the scheduler's pool */
775 #ifdef ABT_CONFIG_DISABLE_POOL_PRODUCER_CHECK
776  ABTI_pool_push(p_pool, p_task->unit);
777 #else
778  abt_errno = ABTI_pool_push(p_pool, p_task->unit,
779  ABTI_self_get_native_thread_id(p_local));
780  ABTI_CHECK_ERROR(abt_errno);
781 #endif
782 
783 fn_exit:
784  return abt_errno;
785 
786 fn_fail:
787  HANDLE_ERROR_FUNC_WITH_CODE(abt_errno);
788  goto fn_exit;
789 }
790 
791 void ABTI_task_free(ABTI_local *p_local, ABTI_task *p_task)
792 {
793  LOG_EVENT("[T%" PRIu64 "] freed\n", ABTI_task_get_id(p_task));
794 
795  /* Free the unit */
796  p_task->p_pool->u_free(&p_task->unit);
797 
798  /* Free the key-value table */
799  if (p_task->p_keytable) {
800  ABTI_ktable_free(p_task->p_keytable);
801  }
802 
803  ABTI_mem_free_task(p_local, p_task);
804 }
805 
806 void ABTI_task_print(ABTI_task *p_task, FILE *p_os, int indent)
807 {
808  char *prefix = ABTU_get_indent_str(indent);
809 
810  if (p_task == NULL) {
811  fprintf(p_os, "%s== NULL TASKLET ==\n", prefix);
812  goto fn_exit;
813  }
814 
815  ABTI_xstream *p_xstream = p_task->p_xstream;
816  int xstream_rank = p_xstream ? p_xstream->rank : 0;
817  char *state;
818  switch (ABTD_atomic_acquire_load_int(&p_task->state)) {
820  state = "READY";
821  break;
823  state = "RUNNING";
824  break;
826  state = "TERMINATED";
827  break;
828  default:
829  state = "UNKNOWN";
830  }
831 
832  fprintf(p_os,
833  "%s== TASKLET (%p) ==\n"
834  "%sid : %" PRIu64 "\n"
835  "%sstate : %s\n"
836  "%sES : %p (%d)\n"
837 #ifndef ABT_CONFIG_DISABLE_STACKABLE_SCHED
838  "%sis_sched : %p\n"
839 #endif
840  "%spool : %p\n"
841 #ifndef ABT_CONFIG_DISABLE_MIGRATION
842  "%smigratable: %s\n"
843 #endif
844  "%srefcount : %u\n"
845  "%srequest : 0x%x\n"
846  "%sp_arg : %p\n"
847  "%skeytable : %p\n",
848  prefix, (void *)p_task, prefix, ABTI_task_get_id(p_task), prefix,
849  state, prefix, (void *)p_task->p_xstream, xstream_rank,
850 #ifndef ABT_CONFIG_DISABLE_STACKABLE_SCHED
851  prefix, (void *)p_task->is_sched,
852 #endif
853  prefix, (void *)p_task->p_pool,
854 #ifndef ABT_CONFIG_DISABLE_MIGRATION
855  prefix, (p_task->migratable == ABT_TRUE) ? "TRUE" : "FALSE",
856 #endif
857  prefix, p_task->refcount, prefix,
858  ABTD_atomic_acquire_load_uint32(&p_task->request), prefix,
859  p_task->p_arg, prefix, (void *)p_task->p_keytable);
860 
861 fn_exit:
862  fflush(p_os);
863  ABTU_free(prefix);
864 }
865 
866 static ABTD_atomic_uint64 g_task_id = ABTD_ATOMIC_UINT64_STATIC_INITIALIZER(0);
867 void ABTI_task_reset_id(void)
868 {
869  ABTD_atomic_release_store_uint64(&g_task_id, 0);
870 }
871 
872 uint64_t ABTI_task_get_id(ABTI_task *p_task)
873 {
874  if (p_task->id == ABTI_TASK_INIT_ID) {
875  p_task->id = ABTI_task_get_new_id();
876  }
877  return p_task->id;
878 }
879 
880 /*****************************************************************************/
881 /* Internal static functions */
882 /*****************************************************************************/
883 
884 static inline uint64_t ABTI_task_get_new_id(void)
885 {
886  return ABTD_atomic_fetch_add_uint64(&g_task_id, 1);
887 }
struct ABT_xstream_opaque * ABT_xstream
Definition: abt.h:251
char * ABTU_get_indent_str(int indent)
Definition: util.c:12
int ABT_task_cancel(ABT_task task)
Request the cancellation of the target task.
Definition: task.c:302
struct ABT_task_opaque * ABT_task
Definition: abt.h:289
int ABT_task_create(ABT_pool pool, void(*task_func)(void *), void *arg, ABT_task *newtask)
Create a new task and return its handle through newtask.
Definition: task.c:44
int ABT_bool
Definition: abt.h:309
int ABT_task_join(ABT_task task)
Wait for the tasklet to terminate.
Definition: task.c:266
#define ABT_ERR_INV_TASK
Definition: abt.h:82
int ABT_task_self(ABT_task *task)
Return the handle of the calling tasklet.
Definition: task.c:337
struct ABT_pool_opaque * ABT_pool
Definition: abt.h:267
int ABT_task_create_on_xstream(ABT_xstream xstream, void(*task_func)(void *), void *arg, ABT_task *newtask)
Create a new tasklet associated with the target ES (xstream).
Definition: task.c:135
#define ABT_FALSE
Definition: abt.h:224
ABT_task_state
Definition: abt.h:131
int ABT_task_equal(ABT_task task1, ABT_task task2, ABT_bool *result)
Compare two tasklet handles for equality.
Definition: task.c:615
#define HANDLE_ERROR_FUNC_WITH_CODE(n)
Definition: abti_error.h:241
int ABT_task_get_id(ABT_task task, uint64_t *task_id)
Get the tasklet's id.
Definition: task.c:634
ABTI_global * gp_ABTI_global
Definition: global.c:14
#define ABT_SUCCESS
Definition: abt.h:64
int ABT_task_get_last_pool(ABT_task task, ABT_pool *pool)
Return the last pool of task.
Definition: task.c:480
#define LOG_EVENT(fmt,...)
Definition: abti_log.h:60
int ABT_task_set_migratable(ABT_task task, ABT_bool flag)
Set the tasklet's migratability.
Definition: task.c:546
#define ABT_TRUE
Definition: abt.h:223
#define ABT_ERR_UNINITIALIZED
Definition: abt.h:65
int ABT_task_get_arg(ABT_task task, void **arg)
Retrieve the argument for the tasklet function.
Definition: task.c:663
static ABTD_atomic_uint64 g_task_id
Definition: task.c:866
#define ABT_ERR_FEATURE_NA
Definition: abt.h:115
int ABT_task_get_state(ABT_task task, ABT_task_state *state)
Return the state of task.
Definition: task.c:450
#define ABT_ERR_MIGRATION_NA
Definition: abt.h:113
int ABT_task_get_last_pool_id(ABT_task task, int *id)
Get the last pool's ID of the tasklet.
Definition: task.c:512
int ABT_task_self_id(uint64_t *id)
Return the ID of the calling tasklet.
Definition: task.c:382
int ABT_task_free(ABT_task *task)
Release the task object associated with task handle.
Definition: task.c:220
#define ABT_ERR_INV_XSTREAM
Definition: abt.h:68
#define ABT_TASK_NULL
Definition: abt.h:346
static void ABTU_free(void *ptr)
Definition: abtu.h:32
int ABT_task_is_migratable(ABT_task task, ABT_bool *flag)
Get the tasklet's migratability.
Definition: task.c:580
int ABT_task_get_xstream(ABT_task task, ABT_xstream *xstream)
Get the ES associated with the target tasklet.
Definition: task.c:424
int ABT_task_revive(ABT_pool pool, void(*task_func)(void *), void *arg, ABT_task *task)
Revive the tasklet.
Definition: task.c:184