| 455 | } |
| 456 | |
| 457 | int bthread_fd_timedwait(int fd, unsigned events, |
| 458 | const timespec* abstime) { |
| 459 | if (NULL == abstime) { |
| 460 | return bthread_fd_wait(fd, events); |
| 461 | } |
| 462 | if (fd < 0) { |
| 463 | errno = EINVAL; |
| 464 | return -1; |
| 465 | } |
| 466 | bthread::TaskGroup* g = bthread::tls_task_group; |
| 467 | if (NULL != g && !g->is_current_pthread_task()) { |
| 468 | return bthread::get_epoll_thread(fd).fd_wait( |
| 469 | fd, events, abstime); |
| 470 | } |
| 471 | return bthread::pthread_fd_wait(fd, events, abstime); |
| 472 | } |
| 473 | |
| 474 | int bthread_connect(int sockfd, const sockaddr* serv_addr, |
| 475 | socklen_t addrlen) { |