Re: GtkApplication Thread Initialization



The answer is that it depends on what versions you have, I think though
that GApplication comes from a version of glib with threading
automatically initialized ?

Not sure, in some code that I need to compile with various versions I have
code setup like this:

gint
main (gint argc, gchar *argv[])
{
  /* Initialize threading in older libraries */
#if (!GLIB_CHECK_VERSION (2, 31, 0))
  g_thread_init (NULL);
#endif

#if (!CLUTTER_CHECK_VERSION (1, 9, 0))
  clutter_threads_init ();
#endif

.....

That's what I had in place for clutter (and the above works
for me... it might be accurate and might not), ... I'm quite certain
that for modern versions of GTK+ the gdk thread lock is
ensured by calling gtk_init() somewhere... not sure since which
version though...

Cheers,
           -Tristan

On Thu, Jul 5, 2012 at 11:58 PM, Jeff Johnston
<jeff johnston mn gmail com> wrote:
> If I use the new GtkApplication class, how do I initialize threading
> support?
>
> I used to do this...
>
> g_type_init ();
> gdk_threads_init ();
> gdk_threads_enter ();
> gtk_init (&argc, &argv);
> /*app code*/
> gtk_main ();
> gdk_threads_leave ()
>
> So If I use the new GtkApplication class where do I do that (in example
> below)?
>
> GtkApplication *app;
> gint status;
> app = gtk_application_new ("org.codeslayer", G_APPLICATION_FLAGS_NONE);
> g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
> status = g_application_run (G_APPLICATION (app), argc, argv);
> g_object_unref (app);
>
>
> -Jeff
>
>
> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org
> https://mail.gnome.org/mailman/listinfo/gtk-list
>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]