|
openDAQ
Open data acquisition platform
|
A thread-pool scheduler that supports scheduling one-off functions as well as dependency graphs. More...
Inheritance diagram for IScheduler:
Collaboration diagram for IScheduler:A thread-pool scheduler that supports scheduling one-off functions as well as dependency graphs.
Public Member Functions | |
| virtual ErrCode INTERFACE_FUNC | scheduleFunction (IFunction *function, IAwaitable **awaitable)=0 |
Schedules the specified work function to run on the thread-pool. The call does not block but immediately returns an awaitable that represents the asynchronous execution. It can be waited upon and queried for status and result. More... | |
| virtual ErrCode INTERFACE_FUNC | scheduleWork (IWork *work)=0 |
| Schedules the specified work callback to run on the thread-pool. The call does not block. More... | |
| virtual ErrCode INTERFACE_FUNC | scheduleGraph (ITaskGraph *graph, IAwaitable **awaitable)=0 |
Schedules the specified dependency graph to run on the thread-pool. The call does not block but immediately returns an awaitable that represents the asynchronous execution. It can be waited upon and queried for status and result. Any exceptions that occur during the graph execution are silently ignored. More... | |
| virtual ErrCode INTERFACE_FUNC | stop ()=0 |
| Cancels all outstanding work and waits for the remaining to complete. After this point the scheduler does not allow any new work or graphs for scheduling. | |
| virtual ErrCode INTERFACE_FUNC | waitAll ()=0 |
| Waits fo all current scheduled work and tasks to complete. | |
| virtual ErrCode INTERFACE_FUNC | isMultiThreaded (Bool *multiThreaded)=0 |
| Returns whether more than one worker thread is used. More... | |
| virtual ErrCode INTERFACE_FUNC | runMainLoop (SizeT loopTime=1)=0 |
| Starts and blocks the main event loop, executing scheduled tasks. More... | |
| virtual ErrCode INTERFACE_FUNC | isMainLoopSet (Bool *isSet)=0 |
| Checks if the main loop is currently set. More... | |
| virtual ErrCode INTERFACE_FUNC | stopMainLoop ()=0 |
| Signals the main loop to stop processing and return from runMainLoop. More... | |
| virtual ErrCode INTERFACE_FUNC | runMainLoopIteration ()=0 |
| Executes a single iteration of the main loop, processing scheduled tasks. More... | |
| virtual ErrCode INTERFACE_FUNC | scheduleWorkOnMainLoop (IWork *work)=0 |
| Schedules a task to be executed by the main loop. More... | |
Public Member Functions inherited from IBaseObject | |
| virtual ErrCode INTERFACE_FUNC | borrowInterface (const IntfID &intfID, void **obj) const =0 |
| Returns another interface which is supported by the object without incrementing the reference count. More... | |
| virtual ErrCode INTERFACE_FUNC | dispose ()=0 |
| Disposes all references held by the object. More... | |
| virtual ErrCode INTERFACE_FUNC | getHashCode (SizeT *hashCode)=0 |
| Returns hash code of the object. More... | |
| virtual ErrCode INTERFACE_FUNC | equals (IBaseObject *other, Bool *equal) const =0 |
| Compares object to another object for equality. More... | |
| virtual ErrCode INTERFACE_FUNC | toString (CharPtr *str)=0 |
| Returns a string representation of the object. More... | |
Public Member Functions inherited from IUnknown | |
| virtual ErrCode INTERFACE_FUNC | queryInterface (const IntfID &intfID, void **obj)=0 |
| Returns another interface which is supported by the object and increments the reference count. More... | |
| virtual int INTERFACE_FUNC | addRef ()=0 |
| Increments the reference count for an interface on an object. More... | |
| virtual int INTERFACE_FUNC | releaseRef ()=0 |
| Decrements the reference count for an interface on an object. More... | |
|
pure virtual |
Checks if the main loop is currently set.
| [out] | isSet | Returns true if the main loop is set and running. |
This method does not gauarantee that the main loop is currently running, only that it has been set up.
|
pure virtual |
Returns whether more than one worker thread is used.
| [out] | multiThreaded | Returns true if more that one worker thread is used by the scheduler. |
|
pure virtual |
Starts and blocks the main event loop, executing scheduled tasks.
| loopTime | The maximum time to block the loop, in milliseconds. |
This method runs the main loop, processing all enqueued work (including repetitive tasks) until stopMainLoop is called. Typically executed on the main thread or in a dedicated loop thread.
|
pure virtual |
Executes a single iteration of the main loop, processing scheduled tasks.
This non-blocking method runs one iteration of the main loop, executing one-time tasks and advancing any repetitive tasks. Intended for cases where the main loop is polled manually, such as in GUI frameworks or embedded systems.
|
pure virtual |
Schedules the specified work function to run on the thread-pool. The call does not block but immediately returns an awaitable that represents the asynchronous execution. It can be waited upon and queried for status and result.
| function | The function to schedule for execution. | |
| [out] | awaitable | The object representing the state and result of the execution. |
| OPENDAQ_ERR_SCHEDULER_STOPPED | when the scheduler already stopped and is not accepting any more work. |
|
pure virtual |
Schedules the specified dependency graph to run on the thread-pool. The call does not block but immediately returns an awaitable that represents the asynchronous execution. It can be waited upon and queried for status and result. Any exceptions that occur during the graph execution are silently ignored.
| graph | The dependency graph (acyclic directed graph) to schedule. | |
| [out] | awaitable | The object representing the state and result of the execution. |
| OPENDAQ_ERR_SCHEDULER_STOPPED | when the scheduler already stopped and is not accepting any more work. |
Schedules the specified work callback to run on the thread-pool. The call does not block.
| work | The function to schedule for execution. |
| OPENDAQ_ERR_SCHEDULER_STOPPED | when the scheduler already stopped and is not accepting any more work. |
Work is a lightweight callback that returns no value and accepts no procedure. It has less overhead than function. The function does not return awaitable object.
Schedules a task to be executed by the main loop.
The provided work object is queued for execution during a call to either runMainLoop or runMainLoopIteration. This mechanism is commonly used to marshal tasks from background threads to the main loop thread.
| work | A lightweight, non-blocking task object to be scheduled. |
|
pure virtual |
Signals the main loop to stop processing and return from runMainLoop.
This method unblocks the loop and requests graceful shutdown. It is typically called from another thread or in response to an application shutdown signal. Has no effect if the loop is not currently running.