Self - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Mozilla Firefox.

Online Help

All Products    Maple    MapleSim


Threads

  

Self

  

return the thread identifier of the current thread

 

Calling Sequence

Description

Examples

Calling Sequence

Self()

Description

• 

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.

Examples

> 

id≔Threads:-Create⁡print⁡Threads:-Self⁡

id≔1

(1)
> 

Threads:-Wait⁡id

> 

n≔5

n≔5

(2)
> 

t := table();
p := proc( t )
    t[ Threads:-Self() ] := 1;
end proc;

t≔table⁡

p ≔ proctt[Threads:-Self⁡] ≔ 1end proc

(3)
> 

s≔seq⁡Threads:-Create⁡p⁡t,i=1..n

s≔2,3,4,5,6

(4)
> 

Threads:-Wait⁡op⁡s

> 

indices⁡t

2,3,4,5,6

(5)

See Also

Threads

Threads[ConditionVariable]

Threads[Create]

Threads[Mutex]

Threads[Wait]