examples: annotate examples
[nit.git] / lib / pthreads / threadpool.nit
index cbb6594..927cdbf 100644 (file)
@@ -42,6 +42,15 @@ class ThreadPool
                queue.push(task)
                cond.signal
        end
+
+       # Join all threads, waiting for all tasks to be completed
+       fun join_all do
+               # Wait
+               for t in threads do t.join
+
+               # Reset
+               threads.clear
+       end
 end
 
 # A Thread running in a threadpool