Created
June 28, 2016 16:21
-
-
Save dogbert17/ad42869f2b0b638932648d022b40d57c to your computer and use it in GitHub Desktop.
Attempt to document Thread.app_lifetime
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=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