]> git.mxchange.org Git - flightgear.git/commitdiff
From Benoit Laniel: replace SG threading constructs with OpenThreads
authortimoore <timoore>
Thu, 12 Jun 2008 08:24:39 +0000 (08:24 +0000)
committertimoore <timoore>
Thu, 12 Jun 2008 08:24:39 +0000 (08:24 +0000)
src/Environment/environment_ctrl.cxx
src/Environment/environment_ctrl.hxx
src/Sound/voice.cxx
src/Sound/voice.hxx

index 1446b982f3f0d383520ffac2e146ef938246ab4d..66bb8e484da30a6f9103ce02b3d79a6ea21a94a3 100644 (file)
@@ -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
 }
 
index 69b2bdf220d61c3c95a01512aba04dd25ffd05ac..ace7af410f6030cc614a2ee261e44859bf5cab96 100644 (file)
@@ -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) {}
index d3af414717785c67fa53713caf4d3d2e2b589cb3..cdd90d330a930eb173ed6c5268bab6168f52bfc7 100644 (file)
@@ -71,7 +71,8 @@ void FGVoiceMgr::init()
        }
 
 #if defined(ENABLE_THREADS)
-       _thread->start(1);
+       _thread->setProcessorAffinity(1);
+       _thread->start();
 #endif
 }
 
index b059df179bfae43242289f9a8a321ba1d5adc65a..117ee3aadeaeadf42889f8931705b5696932426b 100644 (file)
 #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