Anonymous user
Atomic updates: Difference between revisions
→{{header|Nim}}
Line 2,425:
The main thread sleeps during 10 seconds, then ask the threads to terminate. For this purpose, we could have used a simple boolean but we have rather chosen to send the termination message via a channel. So each thread receives the number of the channel to listen to and checks regularly if a message ask it to terminate.
The program must be compiled with option <code>--threads:on</code>.
<lang Nim>import locks
|