On Wed, 2009-12-02 at 15:17 +0200, Aapo Rantalainen wrote:
> > but at least that code shows you how to use threads - and you're
> > not even close to how test-threads is implemented.
>
> Hi, now I made my test preloader top of test-thread.c
> This is diff:
> --- old_test-threads.c 2009-12-02 14:53:11.000000000 +0200
> +++ test-threads.c 2009-12-02 15:08:45.000000000 +0200
> @@ -85,6 +85,8 @@
> return FALSE;
> }
>
> +ClutterActor *actor;
> +
> static void
> do_something_very_slow (void)
> {
> @@ -115,6 +117,13 @@
> clutter_threads_add_idle_full (G_PRIORITY_DEFAULT + 30,
> update_label_idle,
> update, NULL);
> +
> + GError* error = NULL;
> + if (!(actor = clutter_texture_new_from_file("image.png", &error))) {
> + fprintf(stderr, "%s\n", error->message);
> + g_error_free(error);
> + }
> +
> }
> }
> }
evidently it's not yet clear, so I'll have to update the documentation
to use big capital letters; maybe even all Caps.
you *can't* *ever* use Clutter API from within a thread that did not
call clutter_init() and clutter_main().
*ever*
not even if you say "please with cherry on top".
you can only call Clutter's API from the same thread that called
clutter_init() and clutter_main().
somebody might reply and say "you can use clutter_threads_enter() and
clutter_threads_leave() pairs to mark the critical sections" -- but that
is neither safe nor portable, and you can't ever assume that it will
work in your code.
again: you cannot call clutter_* API from a thread that did not call
clutter_init() and clutter_main(). the only restriction that might be
lifted in the future is when we drop the default stage creation during
init() - then it will be possible to call clutter_* API only from the
same thread that called clutter_main().
ciao,
Emmanuele.
--
To unsubscribe send a mail to [email protected]