Merged mblock work-in-progress eb/mb -r4798:4808 into trunk.
[debian/gnuradio] / mblock / src / lib / mb_msg_queue.h
index 57f6dd0b3dd8cc233432155b479551f2221279dd..7977b7d80d188c8a0f08f2ebcc288b83ffcfa475 100644 (file)
@@ -37,10 +37,13 @@ class mb_msg_queue : boost::noncopyable
     bool empty_p() const { return head == 0; }
   };
 
-  omni_mutex   d_mutex;
+  omni_mutex    d_mutex;
+  omni_condition d_not_empty;  // reader waits on this
 
   // FIXME add bitmap to indicate which queues are non-empty.
-  subq         d_queue[MB_NPRI];
+  subq          d_queue[MB_NPRI];
+
+  mb_message_sptr get_highest_pri_msg_helper();
 
 public:
   mb_msg_queue();
@@ -53,6 +56,12 @@ public:
    * \brief Delete highest pri message from the queue and return it.
    * Returns equivalent of zero pointer if queue is empty.
    */
+  mb_message_sptr get_highest_pri_msg_nowait();
+
+  /*
+   * \brief Delete highest pri message from the queue and return it.
+   * If the queue is empty, this call blocks until it can return a message.
+   */
   mb_message_sptr get_highest_pri_msg();
 };