标签:read turn timeval 使用 select 描述 span style bsp
int readable_timeo(int fd, int sec) { fd_set rset; struct timeval tv; FD_ZERO(&rset); FD_SET(fd, &rset); tv.tv_sec = sec; tv.tv_usec = 0; return (select(fd+1, &rset, NULL, NULL, &tv)); }
int writeable_timeo(int fd, int sec) { fd_set wset; struct timeval tv; FD_ZERO(&rset); FD_SET(fd, &rset); tv.tv_sec = sec; tv.tv_usec = 0; return (select(fd+1, NULL, &wset, NULL, &tv)); }
标签:read turn timeval 使用 select 描述 span style bsp
原文地址:https://www.cnblogs.com/soldierback/p/10763430.html