diff options
| author | Andreas Fankhauser hiddenalpha.ch | 2025-10-30 02:35:35 +0100 |
|---|---|---|
| committer | Andreas Fankhauser hiddenalpha.ch | 2025-10-30 02:35:35 +0100 |
| commit | 9cd8552f56e96817aa53d782f3de18b07f6e60c5 (patch) | |
| tree | ed6b0264012d908950f9d7e92b695d7207f70aa4 /include/qntan | |
| parent | 4a2c7bbdfd97c5185c08a2a755bed87bae637b4e (diff) | |
| download | Qntan-9cd8552f56e96817aa53d782f3de18b07f6e60c5.tar.gz Qntan-9cd8552f56e96817aa53d782f3de18b07f6e60c5.zip | |
Add a 'Qntan_Scheduler'
(CherryPickd @ 0e7ae9b0e2cb184f4c6d60e32af977e2f3f5de66)
Diffstat (limited to 'include/qntan')
| -rw-r--r-- | include/qntan/Qntan.h | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/include/qntan/Qntan.h b/include/qntan/Qntan.h index c8f6382..56dcff7 100644 --- a/include/qntan/Qntan.h +++ b/include/qntan/Qntan.h @@ -100,13 +100,6 @@ struct Qntan_EvLoop { /* * Process reactor tasks until event loop is signalized to end. */ void (*runUntilDone)( struct Qntan_EvLoop** ); -#if 0 -TODO /* -TODO * TODO that should be something like a 'Scheduler' or similar. */ -TODO void (*setTimeoutMs)( -TODO struct Qntan_EvLoop**, struct Garbage_ThreadPool**, int delayMs, -TODO void(*fn)(int eno, Qntan_Cls), Qntan_Cls ); -#endif /* * returns NON-zero, if called from the EvLoopThread. This is intended for * assertions, to check that one is running on the expected thread. */ @@ -186,10 +179,31 @@ struct Qntan_MemArena { struct Qntan_Executor { - /* - * enque a task to this executor. */ - void (*enque)( - struct Qntan_Executor**, void(*fn)(Qntan_Cls), Qntan_Cls ); + void (*enque)( struct Qntan_Executor**, void(*fn)(Qntan_Cls), Qntan_Cls ); + /* enque a task to this executor. How the task gets executed depends on what + * executor instance got chosen. This also includes stuff like ThreadPools + * which may execute stuff out of order. + */ +}; + + + + + + + + + + +struct Qntan_Scheduler { + /**/ + void (*onceAfterMs)( + struct Qntan_Scheduler**, int delayMs, void(*fn)(Qntan_Cls), Qntan_Cls ); + /* Schedule 'fn' to be called after 'delayMs' milliseconds. + * TODO: Specify if time refers to wall-clock, monotonic, etc. For now this + * behavior is implementation-defined, BUT MAY IT WILL BE SPECIFIED HERE IN + * FUTURE! + */ }; |
