- fd_set trfds, twfds;
- int high;
-
- {
- ScopedLock ml(&m_);
- trfds = rfds_;
- twfds = wfds_;
- high = highfds_;
-
- }
-
- int ret = select(high+1, &trfds, &twfds, NULL, NULL);
-
- if (ret < 0) {
- if (errno == EINTR) {
- return;
- } else {
- perror("select:");
- jsl_log(JSL_DBG_OFF, "PollMgr::select_loop failure errno %d\n",errno);
- VERIFY(0);
- }
- }
-
- for (int fd = 0; fd <= high; fd++) {
- if (fd == pipefd_[0] && FD_ISSET(fd, &trfds)) {
- char tmp;
- VERIFY (read(pipefd_[0],&tmp,sizeof(tmp))==1);
- VERIFY(tmp==1);
- }else {
- if (FD_ISSET(fd, &twfds)) {
- writable->push_back(fd);
- }
- if (FD_ISSET(fd, &trfds)) {
- readable->push_back(fd);
- }
- }
- }
+ fd_set trfds, twfds;
+ int high;
+
+ {
+ lock ml(m_);
+ trfds = rfds_;
+ twfds = wfds_;
+ high = highfds_;
+ }
+
+ int ret = select(high+1, &trfds, &twfds, NULL, NULL);
+
+ if (ret < 0) {
+ if (errno == EINTR) {
+ return;
+ } else {
+ perror("select:");
+ IF_LEVEL(0) LOG("select_loop failure errno " << errno);
+ VERIFY(0);
+ }
+ }
+
+ for (int fd = 0; fd <= high; fd++) {
+ if (fd == pipefd_[0] && FD_ISSET(fd, &trfds)) {
+ char tmp;
+ VERIFY (read(pipefd_[0],&tmp,sizeof(tmp))==1);
+ VERIFY(tmp==1);
+ }else {
+ if (FD_ISSET(fd, &twfds)) {
+ writable->push_back(fd);
+ }
+ if (FD_ISSET(fd, &trfds)) {
+ readable->push_back(fd);
+ }
+ }
+ }