Threads
Wait
wait for a thread to finish
Calling Sequence
Parameters
Description
Examples
Wait( id1, id2, ... )
id1, id2, ...
-
(integer) thread identifiers
The Wait command pauses the current thread until the threads specified as arguments finish.
with⁡Threads
Add,ConditionVariable,Create,Map,Mul,Mutex,Self,Seq,Sleep,Task,Wait
p := proc( limit ) local now, start; start := time[real](); now := start; while now - start < limit do Threads:-Sleep( 0.1 ); now := time[real](); end; return now-start; end:
id ≔ Create⁡p⁡1,'out':
Wait⁡id:
out
1.014
id1 ≔ Create⁡p⁡1,'out1':
id2 ≔ Create⁡p⁡2,'out2':
Wait⁡id1,id2:
out1
1.003
out2
2.010
See Also
Threads[ConditionVariable]
Threads[Create]
Threads[Mutex]
Threads[Self]
Download Help Document