In Thread§

See primary documentation in context for method app lifetime

method app_lifetime(Thread:D: --> Bool:D)

Returns False unless the named parameter :app_lifetime is specifically set to True during object creation. If the method returns False it means that the process will only terminate when the thread has finished while 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;                 # OUTPUT: «False␤» 
say $t2.app_lifetime;                 # OUTPUT: «True␤»