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)
 > $\mathrm{id}≔\mathrm{Create}\left(∫{\mathrm{sin}\left(x\right)}^{x}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}ⅆx,d\right)$
 ${\mathrm{id}}{≔}{1}$ (2)
 > $d$
 ${d}$ (3)
 > $\mathrm{Wait}\left(\mathrm{id}\right)$
 > $d$
 ${∫}{{\mathrm{sin}}{}\left({x}\right)}^{{x}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{ⅆ}{x}$ (4)
 > $\mathrm{id1}≔\mathrm{Create}\left(∫{\left(\frac{1}{x}\right)}^{x}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}ⅆx,\mathrm{d1}\right)$
 ${\mathrm{id1}}{≔}{2}$ (5)
 > $\mathrm{id2}≔\mathrm{Create}\left(∫{x}^{x}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}ⅆx,\mathrm{d2}\right)$
 ${\mathrm{id2}}{≔}{3}$ (6)
 > $\mathrm{d1},\mathrm{d2}$
 ${\mathrm{d1}}{,}{\mathrm{d2}}$ (7)
 > $\mathrm{Wait}\left(\mathrm{id1},\mathrm{id2}\right)$
 > $\mathrm{d1},\mathrm{d2}$
 ${∫}{\left(\frac{{1}}{{x}}\right)}^{{x}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{ⅆ}{x}{,}{∫}{{x}}^{{x}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{ⅆ}{x}$ (8)