[haiku-3rdparty-dev] Re: BMediaNodes communication with the extern world

  • From: Dario Casalinuovo <b.vitruvio@xxxxxxxxx>
  • To: haiku-3rdparty-dev@xxxxxxxxxxxxx
  • Date: Thu, 17 Oct 2013 00:58:38 +0200

> Oh, and there's another reason: BTimedEventQueue is not thread safe.
> And since adding events from outside HandleEvent() or HandleMessage()
> is not allowed, there is no lock on it. If you call AddEvent() from an
> unexpected place and BMediaEventLooper::ControlLoop() is just at the
> same time calling RemoveFirstEvent() then you get undefined behaviour
> which will result in a crash or other nasty stuff. So.. don't do it :)
>

It's locking itself, so it's thread safe :

http://haiku.it.su.se:8180/source/xref/src/kits/media/TimedEventQueuePrivate.cpp#71

I don't understand why the message will be scheduled "late"...it's so
generic.

Other related posts: