fix LV2 worker
authorRobin Gareus <robin@gareus.org>
Mon, 27 Aug 2012 04:08:48 +0000 (04:08 +0000)
committerRobin Gareus <robin@gareus.org>
Mon, 27 Aug 2012 04:08:48 +0000 (04:08 +0000)
start worker thread after _sem and _exit have been initialized.
stop thread when plugin is removed.

git-svn-id: svn://localhost/ardour2/branches/3.0@13145 d708f5d6-7413-0410-9779-e7cbd77b26cf

libs/ardour/ardour/worker.h
libs/ardour/lv2_plugin.cc
libs/ardour/worker.cc

index fe278b9618280fcf31c4518af1b164f633095c82..cdc3d1d06d46be03014bd53b23e391b5190bb756 100644 (file)
@@ -77,12 +77,12 @@ private:
        void run();
 
        Workee*                _workee;
-        Glib::Threads::Thread* _thread;
        RingBuffer<uint8_t>*   _requests;
        RingBuffer<uint8_t>*   _responses;
        uint8_t*               _response;
        PBD::Semaphore         _sem;
        bool                   _exit;
+        Glib::Threads::Thread* _thread;
 };
 
 } // namespace ARDOUR
index 4c2202f2304da1f780f81a63f59fcd46e853b41a..2dc42a321f49f5fe050aedafdd9c1aa830eaaf66 100644 (file)
@@ -560,6 +560,7 @@ LV2Plugin::~LV2Plugin ()
 
        delete _to_ui;
        delete _from_ui;
+       delete _worker;
 
        delete [] _control_data;
        delete [] _shadow_data;
index 290689f13cf0e8b812521a8518a17521841eabb0..67c72ffeba0b4b290865d70022148a948e92e832 100644 (file)
@@ -26,12 +26,12 @@ namespace ARDOUR {
 
 Worker::Worker(Workee* workee, uint32_t ring_size)
        : _workee(workee)
-       , _thread (Glib::Threads::Thread::create(sigc::mem_fun(*this, &Worker::run)))
        , _requests(new RingBuffer<uint8_t>(ring_size))
        , _responses(new RingBuffer<uint8_t>(ring_size))
        , _response((uint8_t*)malloc(ring_size))
        , _sem(0)
        , _exit(false)
+       , _thread (Glib::Threads::Thread::create(sigc::mem_fun(*this, &Worker::run)))
 {}
 
 Worker::~Worker()