Re: calling main_quit from signal_connect - is it possible/legal ?
- From: muppet <scott asofyet org>
- To: "gtk-perl-list gnome org List" <gtk-perl-list gnome org>
- Subject: Re: calling main_quit from signal_connect - is it possible/legal ?
- Date: Sat, 22 Nov 2008 12:28:16 -0500
On Nov 22, 2008, at 5:13 AM, Chas. Owens wrote:
On Mon, Nov 17, 2008 at 21:10, Sergei Steshenko
<sergstesh yahoo com> wrote:
snip
I am not going to call Gtk2->main_quit just for fun, I want to
execute a
really lengthy subroutine taking up to, say, 10 seconds. I've
noticed that
shorter (a couple of seconds) subroutines work fine, but the long
ones
sometimes interfere with GUI behavior - it looks like some events are
either lost or are recognized out of order.
snip
The best way to deal with this is to continue to handle events during
you long subroutines. You can handle all pending events by saying
Gtk2->main_iteration while Gtk2->pending_events;
If your subroutine has loops, then it is a good idea to put the code
above at the top of the loops; otherwise, spread a few instances of
the code through your subroutine.
If it's going to be really long, you might be better off using fork()
and pipes to do the work in a subprocess and leave the ui responsive.
This also gives you the ability to add a "cancel" button to the ui,
which would simply kill() the child process and clean up.
--
Well done, Android. Aperture Science reminds you that Android Hell is
a real place, and you will be sent there at the first sign of defiance.
-- GlaDOS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]