[mythtv] [patch] dtv pthread mutex init

Daniel Thor Kristjansson danielk at mrl.nyu.edu
Tue Jan 4 12:11:08 EST 2005


John Pullan pointed out that a couple mutexes were destroyed in the 
class constructor, instead of being created. I think this was a copy 
paste error. The mutexes are properly initialized later in a different 
class, but this is very ugly. This patch properly initializes the 
mutexes in the DTVRecorder constructor, and removes the now superfluous 
mutex initialization in HDTVRecorder::StartRecording().

-- Daniel
-------------- next part --------------
Index: libs/libmythtv/dtvrecorder.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/dtvrecorder.cpp,v
retrieving revision 1.5
diff -u -r1.5 dtvrecorder.cpp
--- libs/libmythtv/dtvrecorder.cpp	1 Jan 2005 21:01:07 -0000	1.5
+++ libs/libmythtv/dtvrecorder.cpp	4 Jan 2005 17:04:50 -0000
@@ -32,8 +32,8 @@
 {
     ringbuf.run = false;
     ringbuf.buffer = 0;
-    pthread_mutex_destroy(&ringbuf.lock);
-    pthread_mutex_destroy(&ringbuf.lock_stats);
+    pthread_mutex_init(&ringbuf.lock, NULL);
+    pthread_mutex_init(&ringbuf.lock_stats, NULL);
     loop = random() % (report_loops / 2);
 }
 
Index: libs/libmythtv/hdtvrecorder.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/hdtvrecorder.cpp,v
retrieving revision 1.31
diff -u -r1.31 hdtvrecorder.cpp
--- libs/libmythtv/hdtvrecorder.cpp	1 Jan 2005 06:16:17 -0000	1.31
+++ libs/libmythtv/hdtvrecorder.cpp	4 Jan 2005 17:04:50 -0000
@@ -261,8 +261,6 @@
     ringbuf.run = true;
     ringbuf.error = false;
     ringbuf.eof = false;
-    pthread_mutex_init(&ringbuf.lock, NULL);
-    pthread_mutex_init(&ringbuf.lock_stats, NULL);
 
     VERBOSE(VB_RECORD, QString("HD ring buffer size %1 KB")
             .arg(ringbuf.size/1024));


More information about the mythtv-dev mailing list