File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -135,6 +135,22 @@ L<name|#method_name>.
135
135
my $t = Thread.new(code => { for 1..5 -> $v { say $v }}, name => 'calc thread');
136
136
say $t.Str; # OUTPUT: «Thread<3>(calc thread)»
137
137
138
+ = head2 method is-initial-thread
139
+
140
+ method is-initial-thread(--> Bool)
141
+
142
+ Returns a Bool indicating whether the current thread (if called as a class
143
+ method) or the Thread object on which it is called, is the initial thread
144
+ of the program seen from a HLL-language perspective.
145
+
146
+ say Thread.is-initial-thread; # True if this is the initial thread
147
+ say $*THREAD.is-initial-thread; # True if $*THREAD is the initial thread
148
+
149
+ Please note there is no guarantee that this is actually the main thread from
150
+ the OS's point of view. Also note that if you need this other than from a
151
+ pure introspection / debugging point of view, that there are probably better
152
+ ways to achieve what you're trying to achieve.
153
+
138
154
= head1 Routines
139
155
140
156
= head2 sub full-barrier
You can’t perform that action at this time.
0 commit comments