Update Progressbar using SIGALRM fails. Are there alternatives?
- From: "R. Lahaye" <lahaye users sourceforge net>
- To: gtk-app-devel-list gnome org
- Subject: Update Progressbar using SIGALRM fails. Are there alternatives?
- Date: Tue, 08 Jan 2002 01:40:07 +0900
Hi,
[I'm using gtk-1.2 on FreeBSD PC]
I want to use the activity-progressbar to indicate
the activity of a time-consuming function call.
Since this function is from a precompiled library,
there's no way for me to add g_main_iteration(FALSE)
or gtk_widget_draw(progressbar) statements into this
function.
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.
This crashes the code, when the SIGALRM occurs in the middle
of a malloc-call, because the two gtk-functions above also
seem to use malloc, causing malloc to complain and abort:
a.out in malloc(): warning: recursive call.
GLib-ERROR **: could not allocate 96 bytes
aborting...
Abort (core dumped)
This is very uncomfortable! How can I perform an update
of the progressbar every 500 millisec or so?
Using g_timeout_add() doesn't help, since that also is
only activated during eventhandling, so my progressbar
gets updated AFTER the timeconsuming function is finished,
which is useless.
Are there alternatives?
Regards,
Rob.
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?
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]