Wait - Maple Help

 Wait
 wait for a thread to finish

 Calling Sequence Wait( id1, id2, ... )

Parameters

 id1, id2, ... - (integer) thread identifiers

Description

 • The Wait command pauses the current thread until the threads specified as arguments finish.

Examples

 > $\mathrm{with}\left(\mathrm{Threads}\right)$
 $\left[{\mathrm{Add}}{,}{\mathrm{ConditionVariable}}{,}{\mathrm{Create}}{,}{\mathrm{Map}}{,}{\mathrm{Mul}}{,}{\mathrm{Mutex}}{,}{\mathrm{Self}}{,}{\mathrm{Seq}}{,}{\mathrm{Sleep}}{,}{\mathrm{Task}}{,}{\mathrm{Wait}}\right]$ (1)
 > 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:
 > $\mathrm{id}≔\mathrm{Create}\left(p\left(1\right),'\mathrm{out}'\right):$
 > $\mathrm{Wait}\left(\mathrm{id}\right):$
 > $\mathrm{out}$
 ${1.003}$ (2)
 > $\mathrm{id1}≔\mathrm{Create}\left(p\left(1\right),'\mathrm{out1}'\right):$
 > $\mathrm{id2}≔\mathrm{Create}\left(p\left(2\right),'\mathrm{out2}'\right):$
 > $\mathrm{Wait}\left(\mathrm{id1},\mathrm{id2}\right):$
 > $\mathrm{out1}$
 ${1.002}$ (3)
 > $\mathrm{out2}$
 ${2.015}$ (4)