[mythtv-commits] Ticket #3553: Fix Synchronization in MythContext::waitPrivRequest()

MythTV mythtv at cvs.mythtv.org
Mon Jun 4 01:11:47 UTC 2007

#3553: Fix Synchronization in MythContext::waitPrivRequest()
 Reporter:  Russell Bryant <russell at russellbryant.net>  |       Owner:  ijr    
     Type:  patch                                       |      Status:  new    
 Priority:  minor                                       |   Milestone:  unknown
Component:  mythtv                                      |     Version:  unknown
 Severity:  medium                                      |  
 MythContext::waitPrivRequest() uses a QWaitCondition to sleep until there
 is a request pending.  However, it does not use any locking to ensure
 synchronization with threads queueing requests.  Without proper locking,
 it is possible for the caller of waitPrivRequest() to wait forever, even
 though there is a pending request.

 The attached patch changes the following:

  * Change MythContext::waitPrivRequest() to use proper locking to ensure
 synchronization with threads queueing requests.

  * Change the QMutex, m_priv_mutex to not be declared as recursive.  The
 QT API specifies that recursive mutexes can not be used with
 QWaitConditions.  Also, the code that uses this mutex does not justify it
 being declared as recursive.

  * Change the declaration of m_priv_mutex such that it is not allocated
 seperately on the heap.  There does not appear to be any benefit of doing

Ticket URL: <http://svn.mythtv.org/trac/ticket/3553>
MythTV <http://svn.mythtv.org/trac>

More information about the mythtv-commits mailing list