From 9ab45f37c6fa866762fae8bb01f72eacdc75abd3 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Tue, 28 Aug 2012 15:42:35 +0000 Subject: LV2 worker: prevent corruption of ringbuffer git-svn-id: svn://localhost/ardour2/branches/3.0@13146 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/ardour/worker.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'libs/ardour/ardour/worker.h') diff --git a/libs/ardour/ardour/worker.h b/libs/ardour/ardour/worker.h index cdc3d1d06d..4f3ff54bc1 100644 --- a/libs/ardour/ardour/worker.h +++ b/libs/ardour/ardour/worker.h @@ -75,6 +75,16 @@ 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* rb); Workee* _workee; RingBuffer* _requests; @@ -82,7 +92,8 @@ private: uint8_t* _response; PBD::Semaphore _sem; bool _exit; - Glib::Threads::Thread* _thread; + Glib::Threads::Thread* _thread; + }; } // namespace ARDOUR -- cgit v1.2.3