no need to reply me off-list.

On Tue, 2007-09-11 at 16:40 +0200, Luca D wrote:
> 2007/9/10, Emmanuele Bassi <[EMAIL PROTECTED]>:
>         
>         the Clutter threading model is based on taking a lock when
>         using the API
>         from any thread. the ideal approach would be not to call the
>         Clutter API
>         from different threads whenever it's possible - but use an
>         idle handler 
>         set up with clutter_threads_add_idle(), as idle and timeout
>         callbacks
>         are called within the same thread that called clutter_main().
>         if this is
>         not possible, safeguard the API calls using   to lock the
>         main mutex, and threads_leave() to unlock it.
> 
> I prefer not to use clutter_threads_add_idle() because the function
> may spend a long time doing clutter-unrelated things and I don't like
> the main loop to wait unnecessarily.

you misunderstood me.

you should install a idle handler just to manipulate the Clutter API
when done computing stuff inside the thread, so you don't need to
acquire the main Clutter lock - because the API does it for you.

the tests/test-threads.c test case shows you how to use the API and
threads with Clutter.

>         since Clutter threading model heavily borrows from GDK's one
>         (we have 
>         the same issues, plus the fact that we need to safeguard the
>         GL lock,
>         which *must* be one per process), a good reading material is
>         the GDK
>         threading model description:
>         
>           http://library.gnome.org/devel/gdk/unstable/gdk-Threads.html
>         
> 
> Do the following lines taken form the above link also apply to the
> clutter case?
> 
> "Callbacks require a bit of attention. Callbacks from GTK+ signals are
> made within the GTK+ lock. However callbacks from GLib (timeouts, IO
> callbacks, and idle functions) are made outside of the GTK+ lock. So,
> within a signal handler you do not need to call gdk_threads_enter(),
> but within the other types of callbacks, you do."

yep, it doesn't apply. every signal inside Clutter and every
idle/timeout callback installed _using the clutter_threads_add_* API_ is
emitted under the main Clutter lock.

ciao,
 Emmanuele.

-- 
Emmanuele Bassi, OpenedHand Ltd.
Unit R, Homesdale Business Centre
216-218 Homesdale Rd., Bromley - BR12QZ
http://www.o-hand.com

-- 
To unsubscribe send a mail to [EMAIL PROTECTED]

Reply via email to