zoukankan      html  css  js  c++  java
  • select 函数小结 -- 转自百度知道

    http://zhidao.baidu.com/link?url=UVTXeK4ncKmnwatGUW2deMFylNYBuur-zHmK3w53NXNRpgPbhld2WdkMD766nKl_6HjtW3t0tyB5kzFaQDHxha 

    On Linux, select() modifies timeout to reflect the amount of time not slept; most other implementations do not do this. (POSIX.1-2001 permits either behavior.)
    This causes problems both when Linux code which reads timeout is ported to other operating systems, and when code is ported to Linux that reuses a struct timeval
    for multiple select()s in a loop without reinitializing it. Consider timeout to be undefined after select() returns.

    linux在select调用之后会修改timeout值为无sleep的时间。所以第一次select是sleep了timeout设定的时间,然后timeout就被修改为0了(因为全部时间都在sleep,无sleep为0)。
    在循环内调用第二次开始就有问题。
  • 相关阅读:
    Python与数据库
    初识matplotlib
    Jquery--实现轮播图
    Juery入门2
    CSS布局方式
    Jquery入门一
    html-DOM了解
    jquery --入门
    JS练习
    kettle 报错汇总
  • 原文地址:https://www.cnblogs.com/chenchenluo/p/3565580.html
Copyright © 2011-2022 走看看