}
static memcached_return_t io_wait(memcached_instance_st* instance,
- const memc_read_or_write read_or_write)
+ const short events)
{
/*
** We are going to block on write, but at least on Solaris we might block
** The test is moved down in the purge function to avoid duplication of
** the test.
*/
- if (read_or_write == MEM_WRITE)
+ if (events & POLLOUT)
{
if (memcached_purge(instance) == false)
{
struct pollfd fds;
fds.fd= instance->fd;
- fds.events= POLLIN;
+ fds.events= events;
fds.revents= 0;
- if (read_or_write == MEM_WRITE) /* write */
+ if (fds.events & POLLOUT) /* write */
{
- fds.events= POLLOUT;
instance->io_wait_count.write++;
}
else
continue;
}
- memcached_return_t rc= io_wait(instance, MEM_WRITE);
+ memcached_return_t rc= io_wait(instance, POLLOUT);
if (memcached_success(rc))
{
continue;
memcached_return_t memcached_io_wait_for_write(memcached_instance_st* instance)
{
- return io_wait(instance, MEM_WRITE);
+ return io_wait(instance, POLLOUT);
+}
+
+memcached_return_t memcached_io_wait_for_read(memcached_instance_st* instance)
+{
+ return io_wait(instance, POLLIN);
}
static memcached_return_t _io_fill(memcached_instance_st* instance)
#endif
{
memcached_return_t io_wait_ret;
- if (memcached_success(io_wait_ret= io_wait(instance, MEM_READ)))
+ if (memcached_success(io_wait_ret= io_wait(instance, POLLIN)))
{
continue;
}
#ifdef __linux
case ERESTART:
#endif
- if (memcached_success(io_wait(instance, MEM_READ)))
+ if (memcached_success(io_wait(instance, POLLIN)))
{
continue;
}