Reputation: 24364
Does it make sense to both write and read on a socket (SOCK_STREAM
) in parallel with multiple threads? On Linux. Do those syscalls block each other?
Upvotes: 2
Views: 1319
Reputation: 15513
It makes sense as long as there is exactly one writer and one reader thread. If you have more than one reader thread you need to lock reading if you have more than one writer thread you have to lock writing.
Upvotes: 1
Reputation: 137322
Yes, it makes sense. Since they are in separate threads they do not block each other.
Upvotes: 5