title: how to avoid busy waiting between python unrelated processes
body: <p>i have two python unrelated subprocces, and my wait method was something like the following</p>
  <pre><code>def wait(self):
      LIMIT = 3
      t0 = time.time()
      while 1:
          message = self.__read_message()
  
          if message != '\x00':
              break
  
          if time.time() - t0 &gt; LIMIT:
              time.sleep(0.01)
  
      return message
  </code></pre>
  <p>the read message method is reading a message from a mmap shared memory then delete the message</p>
  <pre><code>    def __read_message(self):
      with self.__sem2:
          msg = self.mem[self.__PTR_READ:self.__PTR_READ + self.__MSG_LEN]
          self.mem[self.__PTR_READ:self.__PTR_READ + self.__MSG_LEN] = b&quot;\x00&quot; * self.__MSG_LEN
          self.mem.flush()
  
      return self.__message.unpack(msg)
  </code></pre>
  <p>can i improve it so that there is no busy waiting? i have used the subprocess module to create my other python process if this can help</p>