[openbeosmediakit] Broken locking in old AddOnManager

  • From: "Axel Dörfler" <axeld@xxxxxxxxxxxxxxxx>
  • To: "OpenBeOS Media Kit" <openbeosmediakit@xxxxxxxxxxxxx>
  • Date: Fri, 23 Jan 2004 09:01:04 +0100 CET

Hi there,

just to note it here, since I forgot to put it into the CVS change 
message:

Both AddOnManager::RegisterReader()/Decoder() had a broken locking 
strategy:

void
AddOnManager::RegisterReader()
{
        1) lock
                check if the reader already exists
        unlock

        ... initialize reader ...

        2) lock
                add reader
        unlock
}

When you lock again in 2), the same reader could have been added in the 
meantime; you would have to check for its existence again.
It's better in this case to hold the lock during the whole time, given 
that the whole process is relatively light-weight.

Bye,
   Axel.


Other related posts:

  • » [openbeosmediakit] Broken locking in old AddOnManager