Browse Source

Fixed GCC build. Log amount of created worker threads.

Lasse Öörni 14 years ago
parent
commit
313610c346
3 changed files with 16 additions and 3 deletions
  1. 4 2
      Engine/Audio/Audio.cpp
  2. 1 1
      Engine/Core/SpinLock.h
  3. 11 0
      Engine/Engine/Engine.cpp

+ 4 - 2
Engine/Audio/Audio.cpp

@@ -28,6 +28,7 @@
 #include "Graphics.h"
 #include "GraphicsEvents.h"
 #include "Log.h"
+#include "Mutex.h"
 #include "ProcessUtils.h"
 #include "Profiler.h"
 #include "Sound.h"
@@ -478,9 +479,10 @@ int AudioCallback(const void *inputBuffer, void *outputBuffer, unsigned long fra
     Audio* audio = static_cast<Audio*>(userData);
     
     {
-        audioLock_.Acquire();
+        SpinLock& lock = audio->GetLock();
+        lock.Acquire();
         audio->MixOutput(outputBuffer, framesPerBuffer);
-        audioLock_.Release();
+        lock.Release();
     }
     
     return 0;

+ 1 - 1
Engine/Core/SpinLock.h

@@ -67,7 +67,7 @@ private:
             lock xchg eax, dword ptr [edx]
         }
         #else
-        return __sync_lock_test_and_set(ptr, newValue);
+        return __sync_lock_test_and_set(dest, newValue);
         #endif
     }
     

+ 11 - 0
Engine/Engine/Engine.cpp

@@ -172,6 +172,17 @@ bool Engine::Initialize(const String& windowTitle, const String& logName, const
     Log* log = GetSubsystem<Log>();
     log->Open(logName);
     
+    // Check amount of worker threads
+    WorkQueue* queue = GetSubsystem<WorkQueue>();
+    unsigned numWorkerThreads = queue->GetNumThreads();
+    if (numWorkerThreads)
+    {
+        String workerThreadString = "Created " + String(numWorkerThreads) + " worker thread";
+        if (numWorkerThreads > 1)
+            workerThreadString += "s";
+        LOGINFO(workerThreadString);
+    }
+        
     // Add default resource paths: CoreData package or directory, Data package or directory
     ResourceCache* cache = GetSubsystem<ResourceCache>();
     FileSystem* fileSystem = GetSubsystem<FileSystem>();