summaryrefslogtreecommitdiff
path: root/src/poll.cpp
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2012-02-16 10:04:30 +0900
committerMartin Sustrik <sustrik@250bpm.com>2012-02-16 10:04:30 +0900
commit35797d6c69032fc9eaa472c501b7fbba8e388026 (patch)
treee2405b4d548078506fd80fcf2171d0988d0da561 /src/poll.cpp
parent746cabf4868ff4b9bf46e01a16b43943c8e9454c (diff)
Polling handle is a fixed type now.
Polling handle type was previously dependent on polling mechanism used. Now it is void* in all cases. This patch is a first step in the long way to separate the transports from the core library. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
Diffstat (limited to 'src/poll.cpp')
-rw-r--r--src/poll.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/poll.cpp b/src/poll.cpp
index 48a204e..7a55379 100644
--- a/src/poll.cpp
+++ b/src/poll.cpp
@@ -43,7 +43,7 @@ xs::poll_t::~poll_t ()
worker.stop ();
}
-xs::poll_t::handle_t xs::poll_t::add_fd (fd_t fd_, i_poll_events *events_)
+xs::handle_t xs::poll_t::add_fd (fd_t fd_, i_poll_events *events_)
{
// If the file descriptor table is too small expand it.
fd_table_t::size_type sz = fd_table.size ();
@@ -65,17 +65,17 @@ xs::poll_t::handle_t xs::poll_t::add_fd (fd_t fd_, i_poll_events *events_)
// Increase the load metric of the thread.
adjust_load (1);
- return fd_;
+ return fdtoptr (fd_);
}
void xs::poll_t::rm_fd (handle_t handle_)
{
- fd_t index = fd_table [handle_].index;
+ int index = fd_table [ptrtofd (handle_)].index;
assert (index != retired_fd);
// Mark the fd as unused.
pollset [index].fd = retired_fd;
- fd_table [handle_].index = retired_fd;
+ fd_table [ptrtofd (handle_)].index = retired_fd;
retired = true;
// Decrease the load metric of the thread.
@@ -84,25 +84,25 @@ void xs::poll_t::rm_fd (handle_t handle_)
void xs::poll_t::set_pollin (handle_t handle_)
{
- int index = fd_table [handle_].index;
+ int index = fd_table [ptrtofd (handle_)].index;
pollset [index].events |= POLLIN;
}
void xs::poll_t::reset_pollin (handle_t handle_)
{
- int index = fd_table [handle_].index;
+ int index = fd_table [ptrtofd (handle_)].index;
pollset [index].events &= ~((short) POLLIN);
}
void xs::poll_t::set_pollout (handle_t handle_)
{
- int index = fd_table [handle_].index;
+ int index = fd_table [ptrtofd (handle_)].index;
pollset [index].events |= POLLOUT;
}
void xs::poll_t::reset_pollout (handle_t handle_)
{
- int index = fd_table [handle_].index;
+ int index = fd_table [ptrtofd (handle_)].index;
pollset [index].events &= ~((short) POLLOUT);
}