| 442 | extern "C" { |
| 443 | |
| 444 | int bthread_fd_wait(int fd, unsigned events) { |
| 445 | if (fd < 0) { |
| 446 | errno = EINVAL; |
| 447 | return -1; |
| 448 | } |
| 449 | bthread::TaskGroup* g = bthread::tls_task_group; |
| 450 | if (NULL != g && !g->is_current_pthread_task()) { |
| 451 | return bthread::get_epoll_thread(fd).fd_wait( |
| 452 | fd, events, NULL); |
| 453 | } |
| 454 | return bthread::pthread_fd_wait(fd, events, NULL); |
| 455 | } |
| 456 | |
| 457 | int bthread_fd_timedwait(int fd, unsigned events, |
| 458 | const timespec* abstime) { |