Re: GTK+ 3.6 threading?



Hi,

    Now that from GTK+ 3.6, thread functions are deprecated.  Is there any
new rules to do threading with the gtk+ 3.6 version?

Are you talking about Glib? yes, there are many changes since 2.32
(for now stable version is 2.34), from high level view, the changes
such as new thread creation functions, thread reference counting
functions, thread synchronization tools, etc. and many other functions
and macros has been removed.

In 2.32 and above to create a thread you will use the new
g_thread_new() or the g_thread_try_new() (previously with
g_thread_create()), to create synchronization tools for example a
rwlock then you call g_rwlock_init (previously g_rwlock_new() or
G_STATIC_RWLOCK_INIT), call g_thread_unref() after you finish with the
thread.

    I tried */g_main_context_invoke/*, but seems it did not work. I can't
update GUI from that GSourceFunc. Maybe is my mistaken use...

I don't understand why you call g_main_context_invoke() here but If
you want to call GTK+ functions from your thread, the safe method is
to wrap the functions to a GSourceFunc and call it with g_idle_add()
or g_idle_add_full() (from your thread function).

Regards.


On Tue, Oct 23, 2012 at 9:43 AM, Weitian Leung <Just_Fancy live com> wrote:
Hi,
    Now that from GTK+ 3.6, thread functions are deprecated.  Is there any
new rules to do threading with the gtk+ 3.6 version?
    Just for an example, I want to download many files in background, and
show the progress in GUI, how should I do it?
    I tried */g_main_context_invoke/*, but seems it did not work. I can't
update GUI from that GSourceFunc. Maybe is my mistaken use...
    Anyone know how? Or just give me some examples.

    Sorry for my bad English.
    Thanks.

--
Weitian

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list



-- 
Please do not send me any propriety format such as Microsoft Offices:
Word, Excel, Power Point, etc. Please use standard non-propriety
format such as plain text, HTML, PDF or OpenOffices format.

ROCKSIS | Indonesia



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