summaryrefslogtreecommitdiff
path: root/include/qntan/Qntan.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/qntan/Qntan.h')
-rw-r--r--include/qntan/Qntan.h22
1 files changed, 16 insertions, 6 deletions
diff --git a/include/qntan/Qntan.h b/include/qntan/Qntan.h
index f89f008..bb19954 100644
--- a/include/qntan/Qntan.h
+++ b/include/qntan/Qntan.h
@@ -146,6 +146,11 @@ struct Qntan_EvLoop {
struct Qntan_EvLoop**, void(*fn)(Qntan_Cls), Qntan_Cls );
/* enque a task to the EvLoop. See also Qntan_ThreadPool.enque().
*/
+ int (*isMyThread)( struct Qntan_EvLoop** );
+ /* returns positive, if calling thread belongs to this EventLoop.
+ * Zero if not. Negative values are reserved.
+ * (idea is to have the same method as an `Executor` has)
+ */
void (*addAwaitToken)( struct Qntan_EvLoop** );
/* TODO write doc
*/
@@ -162,6 +167,7 @@ struct Qntan_EvLoop {
int (*isEvLoopThread)( struct Qntan_EvLoop** );
/* returns NON-zero, if called from the EvLoopThread. This is intended for
* assertions, to check that one is running on the expected thread.
+ * TODO: OBSOLETE, use `isMyThread()`
*/
};
@@ -252,6 +258,10 @@ struct Qntan_Executor {
* executor instance got chosen. This also includes stuff like ThreadPools
* which may execute stuff out of order.
*/
+ int (*isMyThread)( struct Qntan_Executor** );
+ /* returns positive, if calling thread belongs to this executor.
+ * Zero if not. Negative values are reserved.
+ */
};
@@ -428,8 +438,8 @@ struct Qntan_IoMux {
* file/socket types in use. High-level modules SHOULD NOT use this type
* directly.
*/
- void (*read)(
- struct Qntan_IoMux**, void*buf, int sz, int cnt, uintptr_t ptrToFILE,
+ void (*read)( struct Qntan_IoMux**,
+ void*buf, int sz, int cnt, uintptr_t ptrToFILE,
void(*onDone)(int ret,Qntan_Cls), Qntan_Cls );
/* Basic idea is from
* "https://pubs.opengroup.org/onlinepubs/009695399/functions/fread.html".
@@ -515,8 +525,8 @@ struct Qntan_IoMux {
* @param arg
* User defined pointer to pass a context to 'onDone'.
*/
- void (*accept)(
- struct Qntan_IoMux**, uintptr_t sockFd, int flgs,
+ void (*accept)( struct Qntan_IoMux**,
+ uintptr_t sockFd, int flgs,
void(*onDone)(int ret, uintptr_t newClientFd, void*sockaddr, int sockaddr_len, Qntan_Cls),
Qntan_Cls );
/* Basic idea is from
@@ -709,8 +719,8 @@ struct Qntan_File {
* Negative numbers indicate errors. Positive values indicate
* number of objects that where read.
*/
- void (*read)(
- struct Qntan_File**, void*buf, int sz, int cnt,
+ void (*read)( struct Qntan_File**,
+ void*buf, int sz, int cnt,
void(*onDone)(int ret,Qntan_Cls), Qntan_Cls );
/* Basic idea is from
* "https://pubs.opengroup.org/onlinepubs/009695399/functions/recv.html".