Merge branch 'master' of git.ardour.org:ardour/ardour
[ardour.git] / libs / ardour / ardour / worker.h
index 984e375c8058275b9c43d2267db6bf8e1e2f8f4b..4f3ff54bc10782898d32a711e7826f246732cc29 100644 (file)
@@ -22,7 +22,7 @@
 
 #include <stdint.h>
 
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
 
 #include "pbd/ringbuffer.h"
 #include "pbd/semaphore.h"
@@ -75,14 +75,25 @@ public:
 
 private:
        void run();
+       /**
+          Peek in RB, get size and check if a block of 'size' is available.
+
+          Handle the unlikley edge-case, if we're called in between the
+          responder writing 'size' and 'data'.
+
+                @param rb the ringbuffer to check
+                @return true if the message is complete, false otherwise
+        */
+       bool verify_message_completeness(RingBuffer<uint8_t>* rb);
+
+       Workee*                _workee;
+       RingBuffer<uint8_t>*   _requests;
+       RingBuffer<uint8_t>*   _responses;
+       uint8_t*               _response;
+       PBD::Semaphore         _sem;
+       bool                   _exit;
+       Glib::Threads::Thread* _thread;
 
-       Workee*              _workee;
-       Glib::Thread*        _thread;
-       RingBuffer<uint8_t>* _requests;
-       RingBuffer<uint8_t>* _responses;
-       uint8_t*             _response;
-       PBD::Semaphore       _sem;
-       bool                 _exit;
 };
 
 } // namespace ARDOUR