On Fri, 2008-06-20 at 12:02 +0800, HASWANI HARISH-VCKR47 wrote:
> Hi All,
>  
> I want to know that whether all Clutter APIs are re-entrant or not?
> Or we need to call  clutter_threads_enter()  and
> clutter_threads_leave()  before making call to clutter APIs.
>  

Clutter operates under a single lock in a threaded environment; this
means that every API call updating the Clutter scenegraph must acquire
the Clutter lock with threads_enter() and release it with
threads_leave().

the interactions with threaded environments, the GLib main loop, GL and
Clutter are non-trivial, though, and can be barely portable. so it is
strongly advised that:

 1. only the thread that invoked clutter_main() is allowed to
    operate on the Clutter scenegraph;

 2. every other thread that wants to operate on the scenegraph
    should add an idle or a timeout callback on the main loop
    which are guaranteed to be executed in the same thread as
    the main loop is.

there is a full example inside Clutter of this pattern, called
test-threads.c.

the behaviour or Clutter is similar to the one used by GDK, so the
documentation at:

  http://library.gnome.org/devel/gdk/stable/gdk-Threads.html

is also a valid starting point.

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