Re: Threads and Gtk2
- From: "A. Pagaltzis" <pagaltzis gmx de>
- To: gtk-perl-list gnome org
- Subject: Re: Threads and Gtk2
- Date: Thu, 20 Oct 2005 18:53:48 +0200
* zentara <zentara zentara net> [2005-10-20 18:35]:
I know goto's are currently out of favor, but it is a pretty
useful here.
sub work{ #the thread code block
$|++;
while(1){
if($thread{'die'} == 1){goto END }
if ( $thread{'go'} == 1 ){
#do your stuff here in a loop and sprinkle the code with
# if($thread{'go'} == 0){last}
# if($thread{'die'} == 1){goto END}
# in case you need to kill the thread or current code run
# during a long running process
$thread{'go'} = 0; #turn off self before returning
}else
{ sleep 1 }
}
END:
}
Wouldnât a simple âreturnâ in place of your âgoto ENDâ work just
as well?
Regards,
--
Aristotle Pagaltzis // <http://plasmasturm.org/>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]