Re: Async processing issue within an event handler

Steve Cookson <[email protected]> Tue, 29 Sep 2015 10:58:44 +0100
Newsgroups gmane.comp.lang.perl.wxperl
Message-ID <[email protected]>
Hi James,

(Whoops, forgot to copy list).

On 28/09/15 16:15, James Lynes wrote:
> Your comment clicked. I see where a Timer will be the way to check my
> flags.
I set mine up to run in:

sub OnInit {
#
# Wx::Timers
#
     # Start processing job queue
     $gl_media_control_available=0;
     $gl_i_Main_Menu->{queue_timer} = Wx::Timer->new( $gl_i_Main_Menu, -1 );
     $gl_i_Main_Menu->{queue_timer} -> Start( 10000 );  # Evrey 10 secs 
normally, (every sec during an exam.)
     Wx::Event::EVT_TIMER( $gl_i_Main_Menu, 
$gl_i_Main_Menu->{queue_timer}, \&i_Mage::on_timer_queue_processing );

     # Start checking for network connectivitiy every 10 secs.
     $gl_i_Main_Menu->{ping_timer} = Wx::Timer->new( $gl_i_Main_Menu, -1  );
     $gl_i_Main_Menu->{ping_timer} -> Start( 10000 );
     Wx::Event::EVT_TIMER( $gl_i_Main_Menu, 
$gl_i_Main_Menu->{ping_timer}, 
\&i_Mage::on_timer_set_internet_connectivity );

         # Connect to Network.
     nw();

     # Start checking hardware every 10 mins (battery life and disk 
utilisation).
     $gl_i_Main_Menu->{hw_timer} = Wx::Timer->new( $gl_i_Main_Menu, -1  );
     $gl_i_Main_Menu->{hw_timer} -> Start( 600000 ); #
     Wx::Event::EVT_TIMER( $gl_i_Main_Menu, $gl_i_Main_Menu->{hw_timer}, 
\&i_Mage::on_timer_check_hardware_slow );
     i_Mage::on_timer_check_hardware_slow();

         return 1;
}

Good luck,

Steve.