diff options
| author | Andreas Fankhauser hiddenalpha.ch | 2025-10-24 23:03:09 +0200 |
|---|---|---|
| committer | Andreas Fankhauser hiddenalpha.ch | 2025-10-24 23:03:09 +0200 |
| commit | 22d412d2e3e108a1b7624bf723a491e075f3c6be (patch) | |
| tree | 9e39cd057c9b67f477190ad0b7df38f44491f907 /include/qntan | |
| parent | 9d73a0d6f19c8032107a64805c943b87e027bafd (diff) | |
| download | Qntan-22d412d2e3e108a1b7624bf723a491e075f3c6be.tar.gz Qntan-22d412d2e3e108a1b7624bf723a491e075f3c6be.zip | |
Add a 1st quick-n-dirty Scheduler.
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 a79dd6f..aaca3a7 100644 --- a/include/qntan/Qntan.h +++ b/include/qntan/Qntan.h @@ -101,13 +101,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. */ @@ -187,10 +180,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)(int eno, 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! + */ }; |
