Commit bfc4420e authored by sebastien's avatar sebastien
Browse files

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
parent 522de968
......@@ -10,7 +10,7 @@ uniprocessor machine with hyper-threading, this is 2.
#include <cstring>
#include "sthread.h"
#ifdef POSIX_THREADS
#ifdef HAVE_PTHREAD
namespace sthread {
template<>
int thread_group<posix>::max_parallel_threads = 2;
......
......@@ -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 <pthread.h>
#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 <stdio.h>
......@@ -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
@<POSIX thread specializations@>;
#else
@<No threading specializations@>;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment