MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / select

Method select

src/remote/inet.cpp:433–472  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

431 }
432
433 void select(timeval* timeout)
434 {
435#ifdef HAVE_POLL
436 slct_ready.clear();
437 bool hasRequest = false;
438 pollfd* const end = slct_poll.end();
439 for (pollfd* pf = slct_poll.begin(); pf < end; ++pf)
440 {
441 pf->revents = pf->events;
442 if (pf->events & SEL_CHECK_MASK)
443 hasRequest = true;
444 }
445
446 if (!hasRequest)
447 {
448 errno = NOTASOCKET;
449 slct_count = -1;
450 return;
451 }
452
453 int milliseconds = timeout ? timeout->tv_sec * 1000 + timeout->tv_usec / 1000 : -1;
454 slct_count = ::poll(slct_poll.begin(), slct_poll.getCount(), milliseconds);
455
456 if (slct_count >= 0) // in case of error return revents may contain something bad
457 {
458 for (pollfd* pf = slct_poll.begin(); pf < end; ++pf)
459 {
460 pf->events = pf->revents;
461 if (pf->revents & SEL_CHECK_MASK)
462 slct_ready.add(pf);
463 }
464 }
465#else
466#ifdef WIN_NT
467 slct_count = ::select(FD_SETSIZE, &slct_fdset, NULL, NULL, timeout);
468#else
469 slct_count = ::select(slct_width, &slct_fdset, NULL, NULL, timeout);
470#endif // WIN_NT
471#endif // HAVE_POLL
472 }
473
474 int getCount()
475 {

Callers 3

aux_connectFunction · 0.80
select_waitFunction · 0.80
packet_receiveFunction · 0.80

Calls 6

selectClass · 0.85
clearMethod · 0.45
endMethod · 0.45
beginMethod · 0.45
getCountMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected