From bfc4420e816fe7b73032368154bd3e473893ff27 Mon Sep 17 00:00:00 2001 From: sebastien Date: Fri, 2 Oct 2009 17:19:37 +0000 Subject: [PATCH] dynare++: * fix the non-threaded mode * use a more standard define to activate the POSIX threads mode git-svn-id: https://www.dynare.org/svn/dynare/trunk@3017 ac1d8469-bf42-47a9-8791-bf33cf982152 --- dynare++/tl/cc/sthread.cweb | 2 +- dynare++/tl/cc/sthread.hweb | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/dynare++/tl/cc/sthread.cweb b/dynare++/tl/cc/sthread.cweb index 4043f56b2..44c2311e1 100644 --- a/dynare++/tl/cc/sthread.cweb +++ b/dynare++/tl/cc/sthread.cweb @@ -10,7 +10,7 @@ uniprocessor machine with hyper-threading, this is 2. #include #include "sthread.h" -#ifdef POSIX_THREADS +#ifdef HAVE_PTHREAD namespace sthread { template<> int thread_group::max_parallel_threads = 2; diff --git a/dynare++/tl/cc/sthread.hweb b/dynare++/tl/cc/sthread.hweb index e8d75cf46..98eae9da6 100644 --- a/dynare++/tl/cc/sthread.hweb +++ b/dynare++/tl/cc/sthread.hweb @@ -40,7 +40,7 @@ associated condition. \endunorderedlist What implementation is selected is governed (at present) by -|POSIX_THREADS|. If it is defined, then POSIX threads are linked. If +|HAVE_PTHREAD|. If it is defined, then POSIX threads are linked. If it is not defined, then serial implementation is taken. In accordance with this, the header file defines macros |THREAD|, |THREAD_GROUP|, and |SYNCHRO| as the picked specialization of |thread| (or |detach_thread|), @@ -78,8 +78,15 @@ member of |thread_group| and |detach_thread_group| classes. #ifndef STHREAD_H #define STHREAD_H -#ifdef POSIX_THREADS +#ifdef HAVE_PTHREAD # include +#else +/* Give valid types for POSIX thread types, otherwise the templates fail in empty mode. + Don't use typedefs because on some systems pthread_t and friends are typedefs even + without the include. */ +# define pthread_t void * +# define pthread_mutex_t void * +# define pthread_cond_t void * #endif #include @@ -104,7 +111,7 @@ namespace sthread { @<|condition_counter| template class declaration@>; @<|detach_thread| template class declaration@>; @<|detach_thread_group| template class declaration@>; -#ifdef POSIX_THREADS +#ifdef HAVE_PTHREAD @; #else @;