[gst-devel] "threadsafe" signals
Thomas Vander Stichele
thomas at apestaart.org
Fri Jan 9 11:08:05 CET 2004
El vie, 09-01-2004 a las 19:53, Benjamin Otte escribió:
> Attached is a file that implements a general way to do threadsafe signal
> marshalling into main contexts. It works on every signal, regardless of
> prototype.
> This is done the following way:
> - When the handler should be emitted, the closure instead adds an idle
> handler with highest priority to the (a) main context.
> - After that the thread blocks until the main context has handled the
> signal.
> - Then it continues.
Funny, apart from the closure thing this is what Julien and I were
talking about yesterday. Glad to see someone is trying this.
I ran the test; it might have issues for Gst. For example, I only see
"Thread 2" displayed, so I'm assuming the main loop due to the mechanism
used is preferring to not redraw for all of the other threads. So there
are some sync issues there. Though I do see it wavering a lot, with
lots of redraws :)
> This has problems:
> 1) It blocks execution of the thread until the main context feels free
> to handle the signal. (Note: only when there's actually a handler
> connected, not by default)
so, for gst, this means we should make the scheduler aware of this and
check if signals are to be handled ?
> 2) If the signal isn't emitted in a thread but from the main context, you
> get a deadlock.
yuck :)
> Do we want this in gstreamer core?
optionally, yes - maybe in a GstThreadSafe element, where the queue
would be tied to the scheduler I would think, and functional hooks that
are noops (or, at least, regular signal functions) for GstThread.
But as long as 2) is a problem, we'd probably better not :)
Thomas
Dave/Dina : future TV today ! - http://www.davedina.org/
<-*- thomas (dot) apestaart (dot) org -*->
No matter how you try you'll never be as cheap as me
when people have got no one else they can always sleep with me
and no one else could be a better friend to you than me
<-*- thomas (at) apestaart (dot) org -*->
URGent, best radio on the net - 24/7 ! - http://urgent.fm/
More information about the gstreamer-devel
mailing list