From 2240d6644df0605dfe50b16bdb099c3af96bd764 Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Thu, 9 Jul 2009 12:31:59 +0200 Subject: [PATCH] RemoteVstPlugin: encapsulate locking in separate inline functions Locking the plugin is now achieved by calling RemoteVstPlugin::lock() and RemoteVstPlugin::unlock(). Signed-off-by: Tobias Doerffel --- plugins/vst_base/remote_vst_plugin.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/plugins/vst_base/remote_vst_plugin.cpp b/plugins/vst_base/remote_vst_plugin.cpp index b2245f32c..580d097f2 100644 --- a/plugins/vst_base/remote_vst_plugin.cpp +++ b/plugins/vst_base/remote_vst_plugin.cpp @@ -204,6 +204,16 @@ public: // has to be called as soon as input- or output-count changes void updateInOutCount(); + inline void lock() + { + pthread_mutex_lock( &m_pluginLock ); + } + + inline void unlock() + { + pthread_mutex_unlock( &m_pluginLock ); + } + static DWORD WINAPI processingThread( LPVOID _param ); static DWORD WINAPI guiEventLoop( LPVOID _param ); @@ -230,13 +240,13 @@ private: void * p = NULL, float f = 0 ) { int ret = 0; - pthread_mutex_lock( &m_pluginLock ); + lock(); if( m_plugin ) { ret = m_plugin->dispatcher( m_plugin, cmd, param1, param2, p, f ); } - pthread_mutex_unlock( &m_pluginLock ); + unlock(); return ret; }