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:
bhaddow 2009-11-13 10:13:55 +00:00
parent 12dda84589
commit c7dea2e497
2 changed files with 10 additions and 1 deletions

View File

@ -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 )

View File

@ -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;
}