nitlanguage
/
nit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
Merge: Functional api
[nit.git]
/
lib
/
pthreads
/
threadpool.nit
diff --git
a/lib/pthreads/threadpool.nit
b/lib/pthreads/threadpool.nit
index
cbb6594
..
927cdbf
100644
(file)
--- a/
lib/pthreads/threadpool.nit
+++ b/
lib/pthreads/threadpool.nit
@@
-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