Python : is it ok to threads read/write simultaneo

2020-04-10 00:21发布

I want to have a reader thread & a writer thread to same TCP socket. Is it ok? Do I need to lock before accessing it ? Platform is Windows 7, CPython 2.7.4

1条回答
我只想做你的唯一
2楼-- · 2020-04-10 00:55

For Unix kernel two threads one reading and other writing to a file (socket) is same as two processes doing the same. As the kernel is capable of Multiplexing the IO you don't need to worry.

查看更多
登录 后发表回答