How to interrupt a fread call?

后端 未结 6 1349
暗喜
暗喜 2021-01-18 13:19

I have the following situation:

There is a thread that reads from a device with a fread call. This call is blocking as long as there is no data send from the device.

6条回答
  •  遇见更好的自我
    2021-01-18 13:26

    You really want to read about the select(2) system call, which will allow you to find out whether there is data available on that file descriptor, without blocking at all or without blocking on only that device.

提交回复
热议问题