当前位置: 技术问答>linux和unix
如何使select调用避免描述符操作的不公平现象
来源: 互联网 发布时间:2015-05-23
本文导语: 请看下面一点程序 ...... while (hcount) { memcpy(&rfds, &rcfds, sizeof(rfds)); memcpy(&wfds, &wcfds, sizeof(wfds)); if (select(nfds, &rfds, &wfds, (fd_set *)0, (struct timeval *)0)
请看下面一点程序
......
while (hcount) {
memcpy(&rfds, &rcfds, sizeof(rfds));
memcpy(&wfds, &wcfds, sizeof(wfds));
if (select(nfds, &rfds, &wfds, (fd_set *)0,
(struct timeval *)0)
......
while (hcount) {
memcpy(&rfds, &rcfds, sizeof(rfds));
memcpy(&wfds, &wcfds, sizeof(wfds));
if (select(nfds, &rfds, &wfds, (fd_set *)0,
(struct timeval *)0)