fdselect()无法返回

[复制链接]
2734|0
 楼主| perekinsun 发表于 2011-1-17 10:39 | 显示全部楼层 |阅读模式
本帖最后由 perekinsun 于 2011-1-19 09:43 编辑

小弟刚写了一个延时函数,使用了NDK中的fdselect(),将前四个参数设为0,使得函数在延时timeout后返回,但是程序运行到fdselect后就无法返回了,感觉阻塞在哪里。
原函数如下,望高手指点。
void vrpn_SleepMsecs( double dMsecs )
{


    timeval timeout;
    // Convert milliseconds to seconds
    timeout.tv_sec = (int)(dMsecs / 1000);
    // Subtract of whole number of seconds
    dMsecs -= timeout.tv_sec * 1000;
    // Convert remaining milliseconds to microsec
    timeout.tv_usec = (int)(dMsecs * 1000);
    // A select() with NULL file descriptors acts like a microsecond
    // timer.
    fdSelect(0, 0, 0, 0, & timeout);  // wait for that long;

}
您需要登录后才可以回帖 登录 | 注册

本版积分规则

0

主题

1

帖子

1

粉丝
快速回复 在线客服 返回列表 返回顶部