打印

fdselect()无法返回

[复制链接]
2178|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

粉丝