Checkpointing centralized event queue stuff. Currently have:

an event queue and events, TCP sockets converted to use events,
unix multithreading and network stuff converted, and an X Windows
event queue subclass.
This commit is contained in:
crs
2004-01-24 16:09:25 +00:00
parent fa215f1b13
commit 4c7e524896
40 changed files with 2215 additions and 296 deletions

View File

@@ -200,11 +200,6 @@ CArchNetworkBSD::acceptSocket(CArchSocket s, CArchNetAddress* addr)
ARCH->testCancelThread();
continue;
}
if (err == ECONNABORTED) {
// connection was aborted; try again
ARCH->testCancelThread();
continue;
}
delete newSocket;
delete *addr;
*addr = NULL;
@@ -244,11 +239,6 @@ CArchNetworkBSD::connectSocket(CArchSocket s, CArchNetAddress addr)
break;
}
if (errno == EAGAIN) {
// connecting
throw XArchNetworkConnecting(new XArchEvalUnix(errno));
}
throwError(errno);
}
} while (false);
@@ -290,14 +280,15 @@ CArchNetworkBSD::pollSocket(CPollEntry pe[], int num, double timeout)
}
// do the poll
int t = (timeout < 0.0) ? -1 : static_cast<int>(1000.0 * timeout);
int n;
do {
n = poll(pfd, num, static_cast<int>(1000.0 * timeout));
n = poll(pfd, num, t);
if (n == -1) {
if (errno == EINTR) {
// interrupted system call
ARCH->testCancelThread();
continue;
return 0;
}
throwError(errno);
}
@@ -382,7 +373,7 @@ CArchNetworkBSD::pollSocket(CPollEntry pe[], int num, double timeout)
// prepare timeout for select
struct timeval timeout2;
struct timeval* timeout2P;
if (timeout < 0) {
if (timeout < 0.0) {
timeout2P = NULL;
}
else {
@@ -404,7 +395,7 @@ CArchNetworkBSD::pollSocket(CPollEntry pe[], int num, double timeout)
if (errno == EINTR) {
// interrupted system call
ARCH->testCancelThread();
continue;
return 0;
}
throwError(errno);
}