18#include "QtCore/private/qeventdispatcher_wasm_p.h"
29 static void socketError(
int fd,
int err,
const char* msg,
void *context);
36 static void setSocketState(
int socket,
bool setReadyRead,
bool setReadyWrite);
38 static void waitForSocketState(QEventDispatcherWasm *eventDispatcher,
int timeout,
int socket,
39 bool checkRead,
bool checkWrite,
bool *selectForRead,
bool *selectForWrite,
bool *socketDisconnect);
45 static std::multimap<
int, QSocketNotifier *> g_socketNotifiers;
46 struct SocketReadyState {
47 QEventDispatcherWasm *waiter =
nullptr;
48 bool waitForReadyRead =
false;
49 bool waitForReadyWrite =
false;
50 bool readyRead =
false;
51 bool readyWrite =
false;
53 static std::map<
int, SocketReadyState> g_socketState;
static void setSocketState(int socket, bool setReadyRead, bool setReadyWrite)
static void setEmscriptenSocketCallbacks()
static void socketConnection(int fd, void *context)
static void socketClose(int fd, void *context)
static void clearSocketState(int socket)
static void waitForSocketState(QEventDispatcherWasm *eventDispatcher, int timeout, int socket, bool checkRead, bool checkWrite, bool *selectForRead, bool *selectForWrite, bool *socketDisconnect)
static void clearEmscriptenSocketCallbacks()
static void socketListen(int fd, void *context)
static void socketOpen(int fd, void *context)
static void unregisterSocketNotifier(QSocketNotifier *notifier)
static void clearSocketNotifiers()
static void registerSocketNotifier(QSocketNotifier *notifier)
static void socketError(int fd, int err, const char *msg, void *context)
static void socketMessage(int fd, void *context)
void runAsync(std::function< void(void)> fn)
void runOnMainThread(std::function< void(void)> fn)