summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qeventdispatcher_wasm_p.h
diff options
context:
space:
mode:
authorMorten Johan Sørvig <morten.sorvig@qt.io>2021-10-10 15:37:22 +0200
committerMorten Johan Sørvig <morten.sorvig@qt.io>2022-01-17 13:55:30 +0100
commit852b3d7648ec22b3f3c9d010c4aef1afd203c9ee (patch)
treed707e8fcf6cb74859cb2a932b292ad8426c930aa /src/corelib/kernel/qeventdispatcher_wasm_p.h
parent68370cf03c2e03ee3c04f5cfde057851ec7ec633 (diff)
wasm: implement socket notifier support
Implement socket notifier support using Emscripten’s socket callbacks. This is sufficient for supporting non-blocking (tunneled) TCP and UDP sockets on the main thread. Change-Id: Ib9ee2698d029fb94d954c6872f8e118b0aa15499 Reviewed-by: David Skoland <david.skoland@qt.io> Reviewed-by: Lorn Potter <lorn.potter@gmail.com> (cherry picked from commit 44d2f97bff647d3e3c0064ad97cf82cb5d3b47b3)
Diffstat (limited to 'src/corelib/kernel/qeventdispatcher_wasm_p.h')
-rw-r--r--src/corelib/kernel/qeventdispatcher_wasm_p.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/corelib/kernel/qeventdispatcher_wasm_p.h b/src/corelib/kernel/qeventdispatcher_wasm_p.h
index 429ec9e129..70437e836c 100644
--- a/src/corelib/kernel/qeventdispatcher_wasm_p.h
+++ b/src/corelib/kernel/qeventdispatcher_wasm_p.h
@@ -103,6 +103,15 @@ private:
void updateNativeTimer();
static void callProcessTimers(void *eventDispatcher);
+ void setEmscriptenSocketCallbacks();
+ void clearEmscriptenSocketCallbacks();
+ static void socketError(int fd, int err, const char* msg, void *context);
+ static void socketOpen(int fd, void *context);
+ static void socketListen(int fd, void *context);
+ static void socketConnection(int fd, void *context);
+ static void socketMessage(int fd, void *context);
+ static void socketClose(int fd, void *context);
+
#if QT_CONFIG(thread)
void runOnMainThread(std::function<void(void)> fn);
#endif
@@ -125,6 +134,7 @@ private:
static QVector<QEventDispatcherWasm *> g_secondaryThreadEventDispatchers;
static std::mutex g_secondaryThreadEventDispatchersMutex;
#endif
+ static std::multimap<int, QSocketNotifier *> g_socketNotifiers;
};
#endif // QEVENTDISPATCHER_WASM_P_H