From c830cf3e66ad79a4bc5ca53e4435da24be1e2ea4 Mon Sep 17 00:00:00 2001 From: "Joshua M. Doe" Date: Thu, 7 Jul 2011 14:13:00 -0400 Subject: [PATCH] decklink: use mutexes from glib instead of pthread Signed-off-by: David Schleef --- sys/decklink/capture.cpp | 13 ++++++------- sys/decklink/capture.h | 4 ++-- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/sys/decklink/capture.cpp b/sys/decklink/capture.cpp index 9a4b8bc..a888081 100644 --- a/sys/decklink/capture.cpp +++ b/sys/decklink/capture.cpp @@ -28,7 +28,6 @@ #include #include #include -#include #include #include @@ -49,20 +48,20 @@ static BMDTimecodeFormat g_timecodeFormat = 0; DeckLinkCaptureDelegate::DeckLinkCaptureDelegate ():m_refCount (0) { - pthread_mutex_init (&m_mutex, NULL); + m_mutex = g_mutex_new(); } DeckLinkCaptureDelegate::~DeckLinkCaptureDelegate () { - pthread_mutex_destroy (&m_mutex); + g_mutex_free (m_mutex); } ULONG DeckLinkCaptureDelegate::AddRef (void) { - pthread_mutex_lock (&m_mutex); + g_mutex_lock (m_mutex); m_refCount++; - pthread_mutex_unlock (&m_mutex); + g_mutex_unlock (m_mutex); return (ULONG) m_refCount; } @@ -70,9 +69,9 @@ DeckLinkCaptureDelegate::AddRef (void) ULONG DeckLinkCaptureDelegate::Release (void) { - pthread_mutex_lock (&m_mutex); + g_mutex_lock (m_mutex); m_refCount--; - pthread_mutex_unlock (&m_mutex); + g_mutex_unlock (m_mutex); if (m_refCount == 0) { delete this; diff --git a/sys/decklink/capture.h b/sys/decklink/capture.h index 3c1ab46..1a2497b 100644 --- a/sys/decklink/capture.h +++ b/sys/decklink/capture.h @@ -18,8 +18,8 @@ class DeckLinkCaptureDelegate : public IDeckLinkInputCallback void *priv; private: - ULONG m_refCount; - pthread_mutex_t m_mutex; + ULONG m_refCount; + GMutex *m_mutex; }; #endif -- 2.7.4