return the thread identifier of the current thread - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : Multithreaded Programming : Threads/Self

Threads[Self] - return the thread identifier of the current thread

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:-CreateprintThreads:-Self

id:=1

(1)

Threads:-Waitid

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:=seqThreads:-Creatept,i=1..n

s:=2,3,4,5,6

(4)

Threads:-Waitops

indicest

2,3,4,5,6

(5)

See Also

Threads, Threads[ConditionVariable], Threads[Create], Threads[Mutex], Threads[Wait]


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam