From 8f46480fb5f63c34ed9420121232a7b4483fbf7d Mon Sep 17 00:00:00 2001
From: Tristan Matthews <tristan.matthews@savoirfairelinux.com>
Date: Thu, 10 Oct 2013 14:22:51 -0400
Subject: [PATCH] Fix SHM mutex

---
 src/videorenderer.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/videorenderer.cpp b/src/videorenderer.cpp
index 7262dae7..cab8cc8c 100644
--- a/src/videorenderer.cpp
+++ b/src/videorenderer.cpp
@@ -207,8 +207,9 @@ bool VideoRenderer::shmLock()
 {
    const timespec timeout = createTimeout();
    /* We need an upper limit on how long we'll wait to avoid locking the whole GUI */
-   if (sem_timedwait(&m_pShmArea->mutex, &timeout) == ETIMEDOUT) {
-      qDebug() << "Timed out before shm lock was acquired";
+   if (sem_timedwait(&m_pShmArea->mutex, &timeout) < 0) {
+       if (errno == ETIMEDOUT)
+           qDebug() << "Timed out before shm lock was acquired";
       return false;
    }
    return true;
-- 
GitLab