TODO(zhujiashun): change name
| 421 | |
| 422 | //TODO(zhujiashun): change name |
| 423 | int stop_and_join_epoll_threads() { |
| 424 | // Returns -1 if any epoll thread failed to stop. |
| 425 | int rc = 0; |
| 426 | for (size_t i = 0; i < BTHREAD_EPOLL_THREAD_NUM; ++i) { |
| 427 | if (epoll_thread[i].stop_and_join() < 0) { |
| 428 | rc = -1; |
| 429 | } |
| 430 | } |
| 431 | return rc; |
| 432 | } |
| 433 | |
| 434 | // For pthreads. |
| 435 | int pthread_fd_wait(int fd, unsigned events, |