Skip to content

Instantly share code, notes, and snippets.

@dogbert17
Created June 28, 2016 16:21
Show Gist options
  • Save dogbert17/ad42869f2b0b638932648d022b40d57c to your computer and use it in GitHub Desktop.
Save dogbert17/ad42869f2b0b638932648d022b40d57c to your computer and use it in GitHub Desktop.
Attempt to document Thread.app_lifetime
=head2 method app_lifetime
method app_lifetime(Thread:D:) returns Bool:D
Returns C<False> unless the named parameter C<:app_lifetime> is specifically set
to C<True> during object creation. If the method returns C<False> it means that the
the process will only terminate when the thread has finished while C<True> means that
the thread will be killed when the main thread of the process terminates.
my $t1 = Thread.new(code => { for 1..5 -> $v { say $v }});
my $t2 = Thread.new(code => { for 1..5 -> $v { say $v }}, :app_lifetime);
say $t1.app_lifetime; # False
say $t2.app_lifetime; # True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment