Threads
Self
return the thread identifier of the current thread
Calling Sequence
Description
Examples
Self()
The Self command returns the threads identifier of the current thread.
For the main thread, the thread identifier is always 0. For other threads, the thread identifier is an integer greater than 0.
id≔Threads:-Create⁡print⁡Threads:-Self⁡
id≔1
Threads:-Wait⁡id
n≔5
t := table(); p := proc( t ) t[ Threads:-Self() ] := 1; end proc;
t≔table⁡
p ≔ proctt[Threads:-Self⁡] ≔ 1end proc
s≔seq⁡Threads:-Create⁡p⁡t,i=1..n
s≔2,3,4,5,6
Threads:-Wait⁡op⁡s
indices⁡t
2,3,4,5,6
See Also
Threads[ConditionVariable]
Threads[Create]
Threads[Mutex]
Threads[Wait]
Download Help Document