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-bf33cf982152time-shift
parent
522de968d0
commit
bfc4420e81
|
@ -10,7 +10,7 @@ uniprocessor machine with hyper-threading, this is 2.
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include "sthread.h"
|
#include "sthread.h"
|
||||||
|
|
||||||
#ifdef POSIX_THREADS
|
#ifdef HAVE_PTHREAD
|
||||||
namespace sthread {
|
namespace sthread {
|
||||||
template<>
|
template<>
|
||||||
int thread_group<posix>::max_parallel_threads = 2;
|
int thread_group<posix>::max_parallel_threads = 2;
|
||||||
|
|
|
@ -40,7 +40,7 @@ associated condition.
|
||||||
\endunorderedlist
|
\endunorderedlist
|
||||||
|
|
||||||
What implementation is selected is governed (at present) by
|
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
|
it is not defined, then serial implementation is taken. In accordance
|
||||||
with this, the header file defines macros |THREAD|, |THREAD_GROUP|,
|
with this, the header file defines macros |THREAD|, |THREAD_GROUP|,
|
||||||
and |SYNCHRO| as the picked specialization of |thread| (or |detach_thread|),
|
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
|
#ifndef STHREAD_H
|
||||||
#define STHREAD_H
|
#define STHREAD_H
|
||||||
|
|
||||||
#ifdef POSIX_THREADS
|
#ifdef HAVE_PTHREAD
|
||||||
# include <pthread.h>
|
# 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
|
#endif
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -104,7 +111,7 @@ namespace sthread {
|
||||||
@<|condition_counter| template class declaration@>;
|
@<|condition_counter| template class declaration@>;
|
||||||
@<|detach_thread| template class declaration@>;
|
@<|detach_thread| template class declaration@>;
|
||||||
@<|detach_thread_group| template class declaration@>;
|
@<|detach_thread_group| template class declaration@>;
|
||||||
#ifdef POSIX_THREADS
|
#ifdef HAVE_PTHREAD
|
||||||
@<POSIX thread specializations@>;
|
@<POSIX thread specializations@>;
|
||||||
#else
|
#else
|
||||||
@<No threading specializations@>;
|
@<No threading specializations@>;
|
||||||
|
|
Loading…
Reference in New Issue