What does poll() do with a timeout of 0?

前端 未结 3 2483
自闭症患者
自闭症患者 2021-02-19 21:02

I\'m looking at the poll() man page, and it tells me the behavior of poll() when positive and negative values are passed in for the timeout parameter.

3条回答
  •  盖世英雄少女心
    2021-02-19 21:28

    It will return immediately:

    If timeout is greater than zero, it specifies a maximum interval (in milliseconds) to wait for any file descriptor to become ready. If timeout is zero, then poll() will return without blocking. If the value of timeout is -1, the poll blocks indefinitely.

    , as of Mac OS X 10.5;

    Maximum interval to wait for the poll to complete, in milliseconds. If this value is 0, poll() will return immediately. If this value is INFTIM (-1), poll() will block indefinitely until a condition is found.

    , as of OpenBSD 3.8

提交回复
热议问题