mirror of
https://github.com/debauchee/barrier.git
synced 2026-11-25 05:12:16 +08:00
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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user