[mythtv] Re: [mythtv-commits] mythtv commits

Daniel Kristjansson danielk at cat.nyu.edu
Sat Apr 9 19:30:27 UTC 2005


On Sat, 2005-04-09 at 15:17 -0400, Isaac Richards wrote:
> On Saturday 09 April 2005 01:45 pm, mythtv at cvs.mythtv.org wrote:
> > ---------------------------------------------------------------------------
> >- Changes committed by danielk on Sat Apr  9 17:44:17 2005
> >
> > Modified Files:
> >    in mythtv:
> >         configure
> > Log Message:
> >
> > Disabled processor specific optimizations for pentiumpro compatible
> > processors, and instead optimize all of those for the "pentiumpro". You can
> > re-enable processor specific optimizations with the "--enable-proc-opt"
> > flag.
> 
> Thanks for making this change - I do agree that a option to enable the more 
> agressive opts should cut down a bit on random problem reports for the 
> release..  
No problem, J. Donovan Stanley wasn't even getting proper backtraces..

> Also, Taylor Jacob's been reporting a deadlock (on the irc channel) with -v 
> all turned on, that doesn't happen without the verbose reporting..  He hasn't 
> gotten a backtrace that I'm aware of, but... think it may be the mutex lock 
> in the verbose macro?
This is possible. If you call a function that depends on another thread within
a verbose macro bad things can happen.

int A1()
{
  wait_for_thread_B_to_finish();
  return val_A;
}

void A2()
{
   VERBOSE(VB_IMPORTANT, "A1: "<<A1());
}

void B()
{
  while(1)
  {
    //do something
    val_A = 1;
    VERBOSE(VB_IMPORTANT, "val_A: "<<val_A);
    wakeup_thread_A;
  }
}

The A's are running in one thread and the B in another.
A2 acquires the verbose lock, then waits on B, which
tries to get the verbose lock, but can't. Now we have
a deadlock.

There are three solutions as I see it: 
1/ Construct the verbose string completely outside of the verbose lock.
   The problem with this is it makes the verbose macro take longer to
   execute.
2/ Examine every VERBOSE macro with redirects in it and either check if
   it is calling a blocking function, or just transform it to use
   QString().arg().arg().. Problem: lots of developer time..
3/ Disable verbose locking in release builds.




More information about the mythtv-dev mailing list