Skip to main content

Dispatch a task (thread.dispatch)

Declaration

task_id = thread.dispatch(task [, on_error ])

Parameters

  • task
    Function. The function to be enqueued as a task.
  • on_error
    Function. Optional error callback. If the task throws, this callback will be invoked and no error is rethrown. Default: throw on error.

Returns

  • task_id
    Integer.

Notes

Dispatch a task to the queue. It will start when other tasks are idle.

Example

See chapter end