From 2c960b7010f766978c86448b6182a48f1bbf970f Mon Sep 17 00:00:00 2001 From: Andreas Fankhauser hiddenalpha.ch Date: Fri, 2 Jan 2026 11:47:35 +0100 Subject: Draft abstract mutx/cond. --- include/qntan/Qntan.h | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) (limited to 'include/qntan') 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)( -- cgit v1.3.1