Re: Gtk+ and multithreating



Am 2007-05-16 21:32:39, schrieb Chris Vine:
The documentation is here:

http://developer.gnome.org/doc/API/2.0/glib/glib-The-Main-Event-Loop.html#g-idle-add

I have the full documentation installed and I have a hardcopy of the PDF.

The idea is that you call g_idle_add() in your worker thread with a
callback (function pointer and data) which you want to execute in the
main program (GUI) loop.

This is what I have tried yesterday...

A simple example would be to call:

g_idle_add((GSourceFunc)g_print, "Hello\n");

If you call this in the worker thread, it will print "Hello" in the GTK+
main program thread (you must have called g_thread_init(NULL) first).

See other message:
I have a problem with g_thread_init(NULL) and do not know why.

Incidentally, instead of using pthreads, you can use the platform
independent GThread implementation.  See:

http://developer.gnome.org/doc/API/2.0/glib/glib-Threads.html

I was trying already...  (checking all posibilities)

Threading is realy new for me..

Thanks, Greetings and nice Day
    Michelle Konzack
    Systemadministrator
    Tamay Dogan Network
    Debian GNU/Linux Consultant


-- 
Linux-User #280138 with the Linux Counter, http://counter.li.org/
##################### Debian GNU/Linux Consultant #####################
Michelle Konzack   Apt. 917                  ICQ #328449886
                   50, rue de Soultz         MSN LinuxMichi
0033/6/61925193    67100 Strasbourg/France   IRC #Debian (irc.icq.com)


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