I am using a socket and this will be use in multithread environment where many thread will write on same socket. Does socket it-self synchronize it or I have to use mutex?
Will one trher will be block if another one is writing on it?
For single write it is atomic. The catch is message ordering (including interleaved message) at receiving side. If it is needed then you need locking. If you don't want to spend too much time on the lock. You can use producer/consumer pattern to decrease locking time.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With