Python : is it ok to threads read/write simultaneously to same TCP socket?

前端 未结 1 1881
小鲜肉
小鲜肉 2021-01-19 05:56

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条回答
  • 2021-01-19 06:42

    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.

    0 讨论(0)
提交回复
热议问题