summaryrefslogtreecommitdiff
path: root/include/qntan
diff options
context:
space:
mode:
authorAndreas Fankhauser hiddenalpha.ch2026-01-02 11:47:35 +0100
committerAndreas Fankhauser hiddenalpha.ch2026-01-02 11:47:35 +0100
commit2c960b7010f766978c86448b6182a48f1bbf970f (patch)
tree30c239d5c787b6aa21e68b0e4a3b795d5c294fed /include/qntan
parenta16e3b28d1e0e5c98bbfc0e7a97b930a439c9169 (diff)
downloadQntan-2c960b7010f766978c86448b6182a48f1bbf970f.tar.gz
Qntan-2c960b7010f766978c86448b6182a48f1bbf970f.zip
Draft abstract mutx/cond.
Diffstat (limited to 'include/qntan')
-rw-r--r--include/qntan/Qntan.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/include/qntan/Qntan.h b/include/qntan/Qntan.h
index 71c6a37..85c55f2 100644
--- a/include/qntan/Qntan.h
+++ b/include/qntan/Qntan.h
@@ -67,6 +67,8 @@ struct Qntan_TarEnc;
struct Qntan_TarEnc_Hdr;
struct Qntan_TarDec;
struct Qntan_TarDec_Hdr;
+struct Qntan_Cond;
+struct Qntan_Mutx;
struct Qntan_Networker;
struct Qntan_CsvDec;
struct Qntan_CsvDec_Mentor;
@@ -804,6 +806,54 @@ struct Qntan_TarDec {
+struct Qntan_Cond {
+ /* An asynchronous Conditional-Variable.
+ */
+ void (*wait)( struct Qntan_Cond**, struct Qntan_Mutx**,
+ int64_t tv_sec, int32_t tv_nsec,
+ void(*onDone)(int ret,Qntan_Cls), Qntan_Cls );
+ /* Same idea as `pthread_cond_timedwait()`.
+ * `tv_sec` and `tv_nsec` have the same idea as in `struct timespec`.
+ * on timeout, `onDone` will be called with `-ETIMEDOUT` (yep, negated).
+ */
+ void (*bcast)( struct Qntan_Cond** );
+ /* Same idea as `pthread_cond_broadcast()`.
+ */
+ void (*signal)( struct Qntan_Cond** );
+ /* Same idea as `pthread_cond_signal()`.
+ */
+};
+
+
+
+
+
+
+
+
+
+
+struct Qntan_Mutx {
+ /* Same idea as a `pthread_mutex_t`, just using virtual funcs, to
+ * increase overkill and make some people sad :D
+ */
+ void (*lock)( struct Qntan_Mutx** );
+ /* Like `pthread_mutex_lock()`
+ */
+ void (*unlock)( struct Qntan_Mutx** );
+ /* Like `pthread_mutex_unlock()`
+ */
+};
+
+
+
+
+
+
+
+
+
+
struct Qntan_Networker {
/**/
void (*getaddrinfo)(