mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-09-11 19:27:11 +03:00
make sure it builds on platforms without pthreads
git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@2618 1f5c12ca-751b-0410-a591-d2e778427230
This commit is contained in:
parent
12dda84589
commit
c7dea2e497
@ -54,7 +54,9 @@ void Moses::ThreadPool::Execute()
|
||||
}
|
||||
m_threadAvailable.notify_all();
|
||||
} while (!m_stopped);
|
||||
#if defined(BOOST_HAS_PTHREADS)
|
||||
TRACE_ERR("Thread " << (int)pthread_self() << " exiting" << endl);
|
||||
#endif
|
||||
}
|
||||
|
||||
void Moses::ThreadPool::Submit( Task* task )
|
||||
|
@ -25,6 +25,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#include <queue>
|
||||
#include <vector>
|
||||
|
||||
#if defined(BOOST_HAS_PTHREADS)
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/thread.hpp>
|
||||
|
||||
@ -86,13 +90,16 @@ class ThreadPool {
|
||||
|
||||
};
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
class TestTask : public Task {
|
||||
public:
|
||||
TestTask(int id) : m_id(id) {}
|
||||
virtual void Run() {
|
||||
#if defined(BOOST_HAS_PTHREADS)
|
||||
int tid = (int)pthread_self();
|
||||
#else
|
||||
int tid = 0;
|
||||
#endif
|
||||
std::cerr << "Executing " << m_id << " in thread id " << tid << std::endl;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user