Re: Threads and Gtk2
- From: ofey aikon <ofey aikon gmail com>
- To: GTK2-Perl List <gtk-perl-list gnome org>
- Subject: Re: Threads and Gtk2
- Date: Wed, 19 Oct 2005 21:58:56 -0400
#!/usr/bin/perl -w
use Gtk2 '-init';
use strict;
use threads;
use threads::shared;
my $keep_running : shared = 1;
my $thr1 = threads->new(
sub {
while ($keep_running == 1 ) {
print "Hello\n";
sleep(1);
}
});
sub button_callback {
$keep_running = 0;
$thr1->join;
Gtk2->main_quit;
}
my $window = Gtk2::Window->new;
my $button = Gtk2::Button->new ("Quit!");
$button->signal_connect (clicked => \&button_callback);
$window->add($button);
$window-> show_all;
Gtk2->main;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]