title: Synchronizing socket send()
body: <p>Alright so basically I have 3 threads.</p>
  
  <p>Each one of them use a function which inside uses the send() on a specific socket (let's call it S).
  Here's a small design:</p>
  
  <p><img src="https://i.stack.imgur.com/1vmJh.png" alt="http://i.imgur.com/5N744.png"></p>
  
  <p>How would I synchronize the S socket in such a way so that send() will be called one after another in a queue instead of the threads accessing the socket all at the same time?</p>