Re: Progress bar question
- From: Ez Coder <ezcoder ianandanne com>
- To: "Jon Michaelchuck,,," <jbm jay-be-em org>
- Cc: Gtk Application Development <gtk-app-devel-list gnome org>
- Subject: Re: Progress bar question
- Date: 07 Apr 2003 23:44:58 +0530
Hi!
The code will not work as the waitpid() call with wait till the child
process dies and only then continue running!
You will need to check for child death via signal and have the parent
program display progress bar and sleep in the loop that checks for child
death. Sorry for being so morbid but ...
Hope this helps.
Regards
On Sat, 2003-04-05 at 01:20, Jon Michaelchuck,,, wrote:
Hi,
I am trying to get a progress bar to pulse while a forked process runs.
Here is my code:
execpid = vfork();
if (execpid == 0) {
if ((execv("/bin/tar", execargs) < 0)) {
fprintf(stderr, "exec error: %s\n", strerror(errno));
abort();
}
_exit(0);
} else {
while (waitpid(execpid, NULL, WNOHANG) == 0) {
gtk_progress_bar_pulse(createbar);
}
}
free(execargs);
return;
It seems that the updating of my app's interface doesn't occur
while this forked process is running. After it runs I do see the
progress indicator at some random position, but during the running
I don't see it move at all.. I have tried it with a very long process
(tarring a huge directory) to see if it was simply too fast for it to
update, but that doesn't seem to be the case. In fact the button that
I hit to trigger this entire process never raises...
Any advice would be appreciated.
Thanks,
jbm
_______________________________________________
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]