title: Thread safety MPI communication
body: <p>In a <a href="https://stackoverflow.com/questions/14836560/thread-safety-of-mpi-send-using-threads-created-with-stdasync">related question</a> I recently learned, that one has to be very careful using MPI with several threads communicating. Since the implementation I use doesn't support <code>MPI_THREAD_MULTIPLE</code>, I just wrapped every <code>MPI::COMM_WORLD</code> call with a <code>std::lock_guard&lt;std::mutex&gt;</code>.</p>
  
  <p>My question now: Is this overkill? To be specific: Can I <code>Send</code> at the exact time I <code>Recv</code>?</p>
  
  <p>I tried it with two <code>std::mutex</code>, one for sending, one for receiving. On my testing machine, I had several test runs without an error, but that isn't a guarantee, it might be just coincidence..</p>
  
  <p>Addition: Now - with hundreds of test runs - there actually occured one lousy segmentation fault, but I'm not 100% sure about if this due to simultaneous send/recv.</p>