summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/sys/epoll
diff options
context:
space:
mode:
authorAndrew Stitcher <astitcher@apache.org>2007-07-27 17:19:30 +0000
committerAndrew Stitcher <astitcher@apache.org>2007-07-27 17:19:30 +0000
commit65ea2f177bd0810590895d89a490af8cea60253b (patch)
tree1a1432d706ac5f43dc8cdd5fdb0d7b5566dd5d06 /cpp/src/qpid/sys/epoll
parent0a7f3f5dde40e59e90588e4ab7ba2ba99651c0f4 (diff)
downloadqpid-python-65ea2f177bd0810590895d89a490af8cea60253b.tar.gz
* Asynchronous network IO subsystem
- This is now implemented such that it very nearly only depends on the platform code (Socker & Poller), this is not 100% true at present, but should be simple to finish. - This is still not the default (use "./configure --disable-apr-netio" to get it) - Interrupting the broker gives a known error - Default for number of broker io threads is not correct (needs to be number of CPUs - it will run slower with too many io threads) * EventChannel code - Deleted all EventChannel code as it's entirely superceded by this new shiny code ;-) * Rearranged the platform Socket implementations a bit for better abstraction git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@560323 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/sys/epoll')
-rw-r--r--cpp/src/qpid/sys/epoll/EpollPoller.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/cpp/src/qpid/sys/epoll/EpollPoller.cpp b/cpp/src/qpid/sys/epoll/EpollPoller.cpp
index 8c3bdbc7d5..37a8510fe6 100644
--- a/cpp/src/qpid/sys/epoll/EpollPoller.cpp
+++ b/cpp/src/qpid/sys/epoll/EpollPoller.cpp
@@ -22,6 +22,7 @@
#include "qpid/sys/Poller.h"
#include "qpid/sys/Mutex.h"
#include "qpid/sys/posix/check.h"
+#include "qpid/sys/posix/PrivatePosix.h"
#include <sys/epoll.h>
#include <errno.h>
@@ -88,11 +89,11 @@ class PollerHandlePrivate {
}
};
-PollerHandle::PollerHandle(int fd0) :
+PollerHandle::PollerHandle(const Socket& s) :
impl(new PollerHandlePrivate),
- fd(fd0)
+ socket(s)
{}
-
+
PollerHandle::~PollerHandle() {
delete impl;
}
@@ -186,7 +187,7 @@ void Poller::addFd(PollerHandle& handle, Direction dir) {
}
epe.data.ptr = &handle;
- QPID_POSIX_CHECK(::epoll_ctl(impl->epollFd, op, handle.getFD(), &epe));
+ QPID_POSIX_CHECK(::epoll_ctl(impl->epollFd, op, toFd(handle.socket.impl), &epe));
// Record monitoring state of this fd
eh.events = epe.events;
@@ -197,7 +198,7 @@ void Poller::delFd(PollerHandle& handle) {
PollerHandlePrivate& eh = *handle.impl;
ScopedLock<Mutex> l(eh.lock);
assert(!eh.isIdle());
- int rc = ::epoll_ctl(impl->epollFd, EPOLL_CTL_DEL, handle.getFD(), 0);
+ int rc = ::epoll_ctl(impl->epollFd, EPOLL_CTL_DEL, toFd(handle.socket.impl), 0);
// Ignore EBADF since deleting a nonexistent fd has the overall required result!
// And allows the case where a sloppy program closes the fd and then does the delFd()
if (rc == -1 && errno != EBADF) {
@@ -216,7 +217,7 @@ void Poller::modFd(PollerHandle& handle, Direction dir) {
epe.events = PollerPrivate::directionToEpollEvent(dir) | ::EPOLLONESHOT;
epe.data.ptr = &handle;
- QPID_POSIX_CHECK(::epoll_ctl(impl->epollFd, EPOLL_CTL_MOD, handle.getFD(), &epe));
+ QPID_POSIX_CHECK(::epoll_ctl(impl->epollFd, EPOLL_CTL_MOD, toFd(handle.socket.impl), &epe));
// Record monitoring state of this fd
eh.events = epe.events;
@@ -232,7 +233,7 @@ void Poller::rearmFd(PollerHandle& handle) {
epe.events = eh.events;
epe.data.ptr = &handle;
- QPID_POSIX_CHECK(::epoll_ctl(impl->epollFd, EPOLL_CTL_MOD, handle.getFD(), &epe));
+ QPID_POSIX_CHECK(::epoll_ctl(impl->epollFd, EPOLL_CTL_MOD, toFd(handle.socket.impl), &epe));
eh.setActive();
}