nitlanguage
/
nit.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
ea91710
)
pthreads: intro `ThreadPool::join_all`
author
Alexis Laferrière
<alexis.laf@xymus.net>
Fri, 3 Feb 2017 19:37:22 +0000
(14:37 -0500)
committer
Alexis Laferrière
<alexis.laf@xymus.net>
Fri, 3 Feb 2017 22:45:02 +0000
(17:45 -0500)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
lib/pthreads/threadpool.nit
patch
|
blob
|
history
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