title: How to check if messages are available in MPI?
body: <p>Is there a way to see if a node is the recipient of a message? Something like this:</p>
  
  <p><code>int MPI_HasMessage()</code></p>
  
  <p>I am trying to write a loop which does work, and is interrupted by the root node (<code>rank = 0</code>) if another node has found the solution. Otherwise it continues.</p>
  
  <pre><code>for(int i = 0; i &lt; workload; i++)
  {
      doWork();
      if(MPI_HasMessage())
      {
          MPI_recv(...);
      }
  }
  </code></pre>