Turi Create
4.0
|
Abstract task queue interface modeled after Grand Central Dispatch. More...
#include <ml/neural_net/TaskQueue.hpp>
Public Member Functions | |
virtual void | DispatchAsync (std::function< void()> task)=0 |
virtual void | DispatchSync (std::function< void()> task)=0 |
virtual void | DispatchApply (size_t n, std::function< void(size_t i)> task)=0 |
Static Public Member Functions | |
static std::shared_ptr< TaskQueue > | GetGlobalConcurrentQueue () |
static std::unique_ptr< TaskQueue > | CreateSerialQueue (const char *label) |
Abstract task queue interface modeled after Grand Central Dispatch.
Definition at line 17 of file TaskQueue.hpp.
|
static |
Returns a task queue that guarantees that if task A is submitted before task B, then task A will finish before task B begins. Accepts a label that may be used by the system to identify work done by this queue.
|
pure virtual |
Submits a function to this task queue n times, with arguments ranging from 0 to n - 1. When dispatched to a concurrent queue, the function must be reentrant. Rethrows the first exception thrown by any task invocation.
Implemented in turi::neural_net::GlobalPosixTaskQueue, turi::neural_net::SerialPosixTaskQueue, and turi::neural_net::GrandCentralDispatchQueue.
|
pure virtual |
Submits a function to this task queue without waiting for the function to finish. The task must not throw an exception.
Implemented in turi::neural_net::GrandCentralDispatchQueue, and turi::neural_net::PosixTaskQueue.
|
pure virtual |
Submits a function to this task queue and waits for the function to execute. The task must not throw an exception.
Implemented in turi::neural_net::GrandCentralDispatchQueue, and turi::neural_net::PosixTaskQueue.
|
static |
Returns a task queue that does not enforce any ordering among its tasks and that shares system resources with other task queues created by this function.