开发者

Is _write in io.h a blocking call?

I've inherited some code which, to initialise some hardware, writes a few bytes and then waits for a return. To do this it calls the _write function from io.h. From my testing, it looks like it's locking up at that point. So my questions are as follows:

  1. Is that function a blocking function?
  2. Is there a way of setting a t开发者_开发问答imeout?
  3. Is there an alternative non-blocking function I could use instead?


If you want to do async I/O on Windows then either use the Win32 APIs directly (look at docs for WriteFileEx/ReadFileEx, which contain pointers to general background on async I/O vs sync) or consider boost::asio.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜