From Benoit Laniel: replace SG threading constructs with OpenThreads
This commit is contained in:
parent
0317d992b9
commit
a9319336ba
4 changed files with 14 additions and 9 deletions
|
@ -356,7 +356,8 @@ FGMetarEnvironmentCtrl::FGMetarEnvironmentCtrl ()
|
|||
{
|
||||
#if defined(ENABLE_THREADS)
|
||||
thread = new MetarThread(this);
|
||||
thread->start( 1 );
|
||||
thread->setProcessorAffinity(1);
|
||||
thread->start();
|
||||
#endif // ENABLE_THREADS
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include <simgear/environment/metar.hxx>
|
||||
|
||||
#if defined(ENABLE_THREADS)
|
||||
# include <simgear/threads/SGThread.hxx>
|
||||
# include <OpenThreads/Thread>
|
||||
# include <simgear/threads/SGQueue.hxx>
|
||||
#endif
|
||||
|
||||
|
@ -233,7 +233,7 @@ private:
|
|||
* This class represents the thread of execution responsible for
|
||||
* fetching the metar data.
|
||||
*/
|
||||
class MetarThread : public SGThread
|
||||
class MetarThread : public OpenThreads::Thread
|
||||
{
|
||||
public:
|
||||
MetarThread( FGMetarEnvironmentCtrl* f ) : fetcher(f) {}
|
||||
|
|
|
@ -71,7 +71,8 @@ void FGVoiceMgr::init()
|
|||
}
|
||||
|
||||
#if defined(ENABLE_THREADS)
|
||||
_thread->start(1);
|
||||
_thread->setProcessorAffinity(1);
|
||||
_thread->start();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,10 @@
|
|||
#include <Main/fg_props.hxx>
|
||||
|
||||
#if defined(ENABLE_THREADS)
|
||||
# include <simgear/threads/SGThread.hxx>
|
||||
# include <OpenThreads/Thread>
|
||||
# include <OpenThreads/Mutex>
|
||||
# include <OpenThreads/ScopedLock>
|
||||
# include <OpenThreads/Condition>
|
||||
# include <simgear/threads/SGQueue.hxx>
|
||||
#else
|
||||
# include <queue>
|
||||
|
@ -74,16 +77,16 @@ private:
|
|||
|
||||
|
||||
#if defined(ENABLE_THREADS)
|
||||
class FGVoiceMgr::FGVoiceThread : public SGThread {
|
||||
class FGVoiceMgr::FGVoiceThread : public OpenThreads::Thread {
|
||||
public:
|
||||
FGVoiceThread(FGVoiceMgr *mgr) : _mgr(mgr) {}
|
||||
void run();
|
||||
void wake_up() { _jobs.signal(); }
|
||||
|
||||
private:
|
||||
void wait_for_jobs() { SGGuard<SGMutex> g(_mutex); _jobs.wait(_mutex); }
|
||||
SGPthreadCond _jobs;
|
||||
SGMutex _mutex;
|
||||
void wait_for_jobs() { OpenThreads::ScopedLock<OpenThreads::Mutex> g(_mutex); _jobs.wait(&_mutex); }
|
||||
OpenThreads::Condition _jobs;
|
||||
OpenThreads::Mutex _mutex;
|
||||
FGVoiceMgr *_mgr;
|
||||
};
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue