Re: Update Progressbar using SIGALRM fails. Are there alternatives?
- From: Havoc Pennington <hp redhat com>
- To: "R. Lahaye" <lahaye users sourceforge net>
- Cc: gtk-list gnome org
- Subject: Re: Update Progressbar using SIGALRM fails. Are there alternatives?
- Date: 07 Jan 2002 20:06:38 -0500
"R. Lahaye" <lahaye users sourceforge net> writes:
> My idea was to set an alarm with the SIGALRM interrupt
> to 500 millisec and have the processbar updated inside
> the SIGALRM handler, calling
> gtk_progress_set_value(GTK_PROGRESS(progressbar), value);
> gtk_widget_draw(progressbar);
> inside the handler.
That very definitely won't work - in general, the only sane thing to
do in signal handlers is set a flag variable. (There are a few more
things you can do in there, but not many.)
> Are there alternatives?
Threads.
> PS: I'm not at all familiar with fork(), but could that provide
> a solution? Having a child process with an alarm set to 500 millisec?
> But the child cannot update a widget of the parent, while the parent
> is busy with that timeconsuming function, or can it?
Nope, processes won't get you anywhere, unless you can run the
timeconsuming function in a child process instead of in the GUI
process.
Havoc
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]