[rygel/rygel-0-24] simple-media-engine: Fix locking



commit 5b5590643fc7830cfd703b2a1040752407b0e258
Author: Jens Georg <mail jensge org>
Date:   Fri Nov 14 22:32:19 2014 +0100

    simple-media-engine: Fix locking
    
    Signed-off-by: Jens Georg <mail jensge org>

 .../simple/rygel-simple-data-source.vala           |   27 +++++++++-----------
 1 files changed, 12 insertions(+), 15 deletions(-)
---
diff --git a/src/media-engines/simple/rygel-simple-data-source.vala 
b/src/media-engines/simple/rygel-simple-data-source.vala
index 3f66941..ec07faa 100644
--- a/src/media-engines/simple/rygel-simple-data-source.vala
+++ b/src/media-engines/simple/rygel-simple-data-source.vala
@@ -68,35 +68,32 @@ internal class Rygel.SimpleDataSource : DataSource, Object {
     }
 
     public void freeze () {
-        if (this.frozen) {
-            return;
+        this.mutex.lock ();
+        if (!this.frozen) {
+            this.frozen = true;
         }
 
-        this.mutex.lock ();
-        this.frozen = true;
         this.mutex.unlock ();
     }
 
     public void thaw () {
-        if (!this.frozen) {
-            return;
+        this.mutex.lock ();
+        if (this.frozen) {
+            this.frozen = false;
+            this.cond.broadcast ();
         }
 
-        this.mutex.lock ();
-        this.frozen = false;
-        this.cond.broadcast ();
         this.mutex.unlock ();
     }
 
     public void stop () {
-        if (this.stop_thread) {
-            return;
+        this.mutex.lock ();
+        if (!this.stop_thread) {
+            this.frozen = false;
+            this.stop_thread = true;
+            this.cond.broadcast ();
         }
 
-        this.mutex.lock ();
-        this.frozen = false;
-        this.stop_thread = true;
-        this.cond.broadcast ();
         this.mutex.unlock ();
     }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]