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