Skip to content

Instantly share code, notes, and snippets.

@Timbus
Created September 7, 2014 18:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Timbus/1afd922304e3c1d1cb22 to your computer and use it in GitHub Desktop.
Save Timbus/1afd922304e3c1d1cb22 to your computer and use it in GitHub Desktop.
Frozen threads?
use GTK::Simple;
my GTK::Simple::App $app .= new(title => "Test");
$app.set_content(
GTK::Simple::VBox.new(
my $input = GTK::Simple::Entry.new(),
my $output = GTK::Simple::Label.new(text => "ready"),
),
);
$input.changed.stable(1).tap: -> $more {
my $then = now;
say "Got $more.text()";
#Waste some cycles here:
my $z = [+] (^500).map({ (^10_000).pick }).grep(*.is-prime);
#Thought it might because I was updating the label. But it wasn't. You can comment the next line out.
$output.text = ($z%100) ~ ('a'...'z').pick(6).join;
say "Took " ~ now - $then;
};
$app.run;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment