Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Germann <ugermann@inf.ed.ac.uk>2015-03-21 19:12:52 +0300
committerUlrich Germann <ugermann@inf.ed.ac.uk>2015-03-21 19:12:52 +0300
commit8ca11d941d99df42664b32c101020283cc83054e (patch)
treeeac36b128d9bfe22ff598458635ae66cdecbf57b /moses/ThreadPool.h
parent85d2567b57af592a3a902209c7b0f3675576aac7 (diff)
1. Lifetime of tasks in ThreadPool is now managed via shared pointers.
2. Code cleanup in IOWrapper and a bit elsewhere.
Diffstat (limited to 'moses/ThreadPool.h')
-rw-r--r--moses/ThreadPool.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/moses/ThreadPool.h b/moses/ThreadPool.h
index bf981a2da..024d1c54d 100644
--- a/moses/ThreadPool.h
+++ b/moses/ThreadPool.h
@@ -26,6 +26,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#include <queue>
#include <vector>
+#include <boost/shared_ptr.hpp>
+
#ifdef WITH_THREADS
#include <boost/bind.hpp>
#include <boost/thread.hpp>
@@ -74,7 +76,7 @@ public:
/**
* Add a job to the threadpool.
**/
- void Submit(Task* task);
+ void Submit(boost::shared_ptr<Task> task);
/**
* Wait until all queued jobs have completed, and shut down
@@ -95,7 +97,7 @@ private:
**/
void Execute();
- std::queue<Task*> m_tasks;
+ std::queue<boost::shared_ptr<Task> > m_tasks;
boost::thread_group m_threads;
boost::mutex m_mutex;
boost::condition_variable m_threadNeeded;