[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mms
Subject:    Re: patch-15 compilation error
From:       Anders Rune Jensen <anders () gnulinux ! dk>
Date:       2005-05-15 8:45:07
Message-ID: 1116146707.7281.11.camel () localhost
[Download RAW message or body]


On Sun, 2005-05-15 at 07:22 +0200, Julian Flake wrote:
> Am Samstag, den 14.05.2005, 22:27 +0200 schrieb Anders Rune Jensen:
> 
> > Ok. The backtraces was very helpful. I think I figured out the problem.
> > Please try patch-19.
> 
> great job, you've made it! I think it's stable now. I tried 20 times ;-)
> to start a movie without resetting dvb oder restarting mms, and had 20
> successes.  hands up in the air!!! :) respect! :)

wheee

> can you tell me, where the rub was? What have you changed? have you just
> applied the patches from 2005/04/09 without the additional output?

The problem all along was that you have two threads running
simultaneously in the dvb. One to render the frames and one to get new
pictures from core to display. When starting to play a movie the render
thread has to be stopped and other thread has to be put on hold until we
return from the movie. I almost got this right by letting the deinit run
atomicly and make sure that none of the other thread can run when we
deinit the dvb. The problem was the first checks I made was wrong. As
you can see here:

void Dvb::unlock()
{
  locked_mutex.enterMutex();
  locked = false;
  deinit();
  locked_mutex.leaveMutex();
}

unlock claims the mutex and unlocks, setting the variable locked to
false.

Wrong:

void Dvb::run()
{
[...]

  while (true) {

    render->device->output_done.signal();
    render->device->output_ready.wait();
    render->device->output_ready.reset();

    if (!locked)
	continue;

    locked_mutex.enterMutex();

The reason why this is wrong is because we can make the locked check and
then go to the mutex. Now the unlock thread can take the mutex and
deinit. After deinit it unlocks the mutex and the run thread continues,
although the dvb has just been deinited!

Correct:

void Dvb::run()
{
[...]

  while (true) {

    render->device->output_done.signal();
    render->device->output_ready.wait();
    render->device->output_ready.reset();

    locked_mutex.enterMutex();

    if (!locked) {
      locked_mutex.leaveMutex();
      continue;
    }
    
The correct solution is to simply check after the mutex. The code gets a
little less pretty, but it works. So it was a race condition.

The other problem was similar to this one.

> thanks,
> nutcase   <<<<<< going to use mms from NOW on ;)

Excellent! Thanks for the persistency.

-- 
Anders Rune Jensen
http://www.cs.auc.dk/~arj/

PGP/GnuPG key: 1024D/62C2D7F0 @ pgp.mit.edu
Fingerprint: 6A03 907E 92E1 47EB 4EAB  76B6 068A ACD1 62C2 D7F0


["signature.asc" (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic