alf_task_wait

NAME

alf_task_wait - Waits for the specified task to finish processing all work blocks on all the scheduled accelerators.

SYNOPSIS

int alf_task_wait(alf_task_handle_t task_handle, int time_out);

Parameters  
task_handle [IN] A task handle that is returned by the alf_create_task API.
time_out [IN] A timeout input with the following options for values:
  • > 0: Waits for up to the number of milliseconds specified before a timeout error occurs.
  • less than 0: Waits until all of the accelerators finish processing.
  • 0: Returns immediately.

DESCRIPTION

This function waits for the specified task to finish processing all work blocks on all the scheduled accelerators. The task must be finalized (alf_task_finalize must be called) before this function is called. Otherwise, an ALF_ERR_PERM is returned. Data referenced by the task's work blocks can only be used safely after this function returns. If the host application updates the data buffers referenced by work blocks or the task context buffer while the task is running, the result can be undetermined. If you need to update the buffer contents, the only safe point is before the ALF_TASK_EVENT_READY task event is handled by the task event handler registered by alf_task_event_handler_register.

RETURN VALUE

0 All of the accelerators finished the job.
less than 0 Errors occurred:
  • ALF_ERR_INVAL: Invalid input argument.
  • ALF_ERR_BADF: Invalid task handle.
  • ALF_ERR_NODATA: The task is (during wait) or was (before wait) destroyed explicitly.
  • ALF_ERR_TIME: Timeout.
  • ALF_ERR_PERM: The API is not permitted at the current context. For example, the task is not finalized.
  • ALF_ERR_GENERIC: Generic internal errors.
Related reference
alf_task_handle_t
alf_task_desc_handle_t
alf_task_desc_create
alf_task_desc_destroy
alf_task_desc_ctx_entry_add
alf_task_desc_set_int32
alf_task_desc_set_int64
alf_task_create
alf_task_finalize
alf_task_query
alf_task_destroy
alf_task_depends_on
alf_task_event_handler_register