Fwd: threads & gtk



I'm not sure about what are you asking...
Bur I think that you should check the fork() return value in order to guess
if you are the parent or if you are the child (forked) process.

In addition... you could consider to use GThreads instead of the libc fork()
system call. It's not a good idea to mix different API's.

Here is a link you can take a look:

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

Regards

---------- Forwarded message ----------
From: chabayo <chabayo yahoo de>
Date: Aug 5, 2006 6:22 PM
Subject: threads & gtk
To: gtk-app-devel-list gnome org

Hello, i'll ask for help with gtk & threading.


The rules of my template:

Create an output Window.
Listen on a Socket for commands.
Listen on a Socket for data.


I wanna have 3 threads - naturally.

Therefor i built that scheme:

main () {
...
  /* init threads */
  g_thread_init(NULL);
  gdk_threads_init();
...
  if ( ! pid ) {
    pid_t pid=fork ();
    gdk_threads_enter ();
    ...
    gdk_threads_leave ();
    exit ( 0 ); }
  else {
    pid_t pid=fork ();
    gdk_threads_enter ();
    ...
    gdk_threads_leave ();
    exit ( 0 ); }
}

...somebody will help me that to trick??


nynhjan





___________________________________________________________
Der frühe Vogel fängt den Wurm. Hier gelangen Sie zum neuen Yahoo! Mail:
http://mail.yahoo.de


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



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