Re: Using threads ?



Thanks a lot :)

This is really a good explanation :)

I'll try it :)

Le jeu 20/02/2003 à 17:24, Stéphane Konstantaropoulos a écrit :
Le jeu 20/02/2003 à 13:35, Alexis Sukrieh a écrit :
Hello list :)

I'm writing a Gtk2 app that have to deal with fork/execl.
Indeed, my app should give an interface over some external binaries.

To sum my problem up, I want to :

- exec a binary in the background from my Gtk2 window
- keep an eye on the binary execution's state (running|finished or X %
complete)
- update some widgets according to the state of the binary execution

As far as I know, the best way here is to use threads but I really don't
know how to poroceed.

Thanks if you can give some help here :)

just run your app this way:

pthread_create(thread, NULL, yourfunct, yourdata)

yourfunction(gpointer data){

ststus = STARTED;
int exit_status;
exit_status = system(yourcommand);

status = FINISHED;

}

status should be either global or available through yourdata.
mind you system is not too reliable with glibc (it catches some signals
without passing them through to the child process)

That's it
-- 


Alexis Sukrieh <alexis sukria net> http://www.sukria.net
********************************************************
Debian/Linux enthusiast geek <http://www.debian.org>
Gnome2 glad user/tuner/hacker <http://www.gnome.org>
MyDynaWeb creator/developer   <http://mydynaweb.net>
********************************************************




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