C++ Pipe ReadFile function set timeout in Windows XP
Is there a way to perform ReadFile
with timeout in Windows XP?
If not, is there a way to break the pipe from oth开发者_StackOverflow社区er thread?
Set up an asynchronous ReadFile using Overlapped I/O. You can then use CancelIOEx to cancel the read at any time.
Assuming you're talking about a named pipe, the usual way is to do an overlapped read, and specify a timeout when you call WaitForSingleObject
(or WaitForMultipleObjects
). When/if the timeout expires, the wait will return WAIT_TIMEOUT
instead of WAIT_OBJECT_0
.
精彩评论