Opened 17 years ago

Closed 17 years ago

#3553 closed patch (fixed)

Fix Synchronization in MythContext::waitPrivRequest()

Reported by: Russell Bryant <russell@…> Owned by: Janne Grunau
Priority: minor Milestone: 0.21
Component: mythtv Version: head
Severity: medium Keywords:
Cc: Ticket locked: no

Description

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 so.

Attachments (2)

mythcontext.13561.txt (1.9 KB) - added by Russell Bryant <russell@…> 17 years ago.
mythcontext.13589.txt (1.7 KB) - added by Russell Bryant <russell@…> 17 years ago.
Updated patch to simplify the loop in waitPrivEvent

Download all attachments as: .zip

Change History (4)

Changed 17 years ago by Russell Bryant <russell@…>

Attachment: mythcontext.13561.txt added

Changed 17 years ago by Russell Bryant <russell@…>

Attachment: mythcontext.13589.txt added

Updated patch to simplify the loop in waitPrivEvent

comment:1 Changed 17 years ago by Janne Grunau

Milestone: unknown0.21
Owner: changed from Isaac Richards to Janne Grunau
Version: unknownhead

comment:2 Changed 17 years ago by Janne Grunau

Resolution: fixed
Status: newclosed

fixed by [13907], off by one error in the commit message

Note: See TracTickets for help on using tickets.