开发者

What do python sockets do with EINTR?

So far my networking code works fine, but I'm a bit worried about something I hid under the carpet:

The man pages for accept, close, connect, recv and send mention that errno.EINTR can show up when a system call was interrupted by a signal.

I am quite clueless here.

What does pyt开发者_Go百科hon do with that ? Does it automatically retry the call, does it raise a socket.error with that errno ? What is the appropriate thing I should do if that exception is raised ? Can I generate these signals myself in my unittests ?


Python simply retries the call and hides the signal from the user (helps with cross-platform consistency where -EINTR doesn't exist). You can safely ignore the EINTR issue but if you'd like to test it anyway, it's easy to do. Just set up a blocking operation that will not return (such as a socket.accept with no incoming connection) and send the process a signal.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜