~493pocbrcycmdw7yksonho9o2qzz-o18bz-d18ecat4t1b76tkfi3vttrkfngli/libmemcached/feature-server_timeout

« back to all changes in this revision

Viewing changes to libmemcached/io.cc

  • Committer: Continuous Integration
  • Date: 2013-11-04 16:18:33 UTC
  • mfrom: (1171.1.2 libmemcached-1.0)
  • Revision ID: ci@tangent.org-20131104161833-727e2c8w4r4t6d8y
Merge lp:~brianaker/libmemcached/osx9-mav Build: jenkins-Libmemcached-376

Show diffs side-by-side

added added

removed removed

Lines of Context:
177
177
}
178
178
 
179
179
static memcached_return_t io_wait(memcached_instance_st* instance,
180
 
                                  const memc_read_or_write read_or_write)
 
180
                                  const short events)
181
181
{
182
182
  /*
183
183
   ** We are going to block on write, but at least on Solaris we might block
187
187
   ** The test is moved down in the purge function to avoid duplication of
188
188
   ** the test.
189
189
 */
190
 
  if (read_or_write == MEM_WRITE)
 
190
  if (events & POLLOUT)
191
191
  {
192
192
    if (memcached_purge(instance) == false)
193
193
    {
197
197
 
198
198
  struct pollfd fds;
199
199
  fds.fd= instance->fd;
200
 
  fds.events= POLLIN;
 
200
  fds.events= events;
201
201
  fds.revents= 0;
202
202
 
203
 
  if (read_or_write == MEM_WRITE) /* write */
 
203
  if (fds.events & POLLOUT) /* write */
204
204
  {
205
 
    fds.events= POLLOUT;
206
205
    instance->io_wait_count.write++;
207
206
  }
208
207
  else
371
370
            continue;
372
371
          }
373
372
 
374
 
          memcached_return_t rc= io_wait(instance, MEM_WRITE);
 
373
          memcached_return_t rc= io_wait(instance, POLLOUT);
375
374
          if (memcached_success(rc))
376
375
          {
377
376
            continue;
409
408
 
410
409
memcached_return_t memcached_io_wait_for_write(memcached_instance_st* instance)
411
410
{
412
 
  return io_wait(instance, MEM_WRITE);
 
411
  return io_wait(instance, POLLOUT);
413
412
}
414
413
 
415
414
memcached_return_t memcached_io_wait_for_read(memcached_instance_st* instance)
416
415
{
417
 
  return io_wait(instance, MEM_READ);
 
416
  return io_wait(instance, POLLIN);
418
417
}
419
418
 
420
419
static memcached_return_t _io_fill(memcached_instance_st* instance)
440
439
#endif
441
440
        {
442
441
          memcached_return_t io_wait_ret;
443
 
          if (memcached_success(io_wait_ret= io_wait(instance, MEM_READ)))
 
442
          if (memcached_success(io_wait_ret= io_wait(instance, POLLIN)))
444
443
          {
445
444
            continue;
446
445
          }
576
575
#ifdef __linux
577
576
      case ERESTART:
578
577
#endif
579
 
        if (memcached_success(io_wait(instance, MEM_READ)))
 
578
        if (memcached_success(io_wait(instance, POLLIN)))
580
579
        {
581
580
          continue;
582
581
        }