On Tue, 2008-05-13 at 10:15 -0300, Pedro Casagrande de Campos wrote:
> Hi,
> 
> 
> I'm having some problems regarding multiples threads accessing clutter 
> resource.
> 
> On my application I'm starting 2 threads: one to listen for the xmlrpc
> requests to the server
> application and other to control the application's state. The problem
> is that the both threads will need to call function that will make
> clutter updates on the ui.

no, this is not supported and will most likely break.

when you want to update the UI inside the thread that did not call
clutter_main() you should install an idle handler with:

  clutter_threads_add_idle (idle_ui_update, NULL):

and declare idle_ui_update() as:

  static gboolean
  idle_ui_update (gpointer data)
  {
    /* from here it's safe to update the UI */
  }

the idle handler is guaranteed to be invoked from the same thread that
has called clutter_main() - and this is the only portable and reliable
way to use Clutter with multiple threads.

you should have a look at the test-threads.c test case shipped in the
Clutter tarball, inside the tests/ directory.

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