|
From: <dv...@us...> - 2008-04-30 01:05:24
|
Revision: 209
http://dunelegacy.svn.sourceforge.net/dunelegacy/?rev=209&view=rev
Author: dvalin
Date: 2008-04-29 18:05:18 -0700 (Tue, 29 Apr 2008)
Log Message:
-----------
give threading a touch of cosmetics
Modified Paths:
--------------
branches/dunks/include/Application.h
branches/dunks/src/Application.cpp
branches/dunks/src/DataCache.cpp
Modified: branches/dunks/include/Application.h
===================================================================
--- branches/dunks/include/Application.h 2008-04-30 00:57:00 UTC (rev 208)
+++ branches/dunks/include/Application.h 2008-04-30 01:05:18 UTC (rev 209)
@@ -2,12 +2,18 @@
#define DUNE_APPLICATION_H
#include "singleton.h"
-#include "State.h"
#include "SDL.h"
#include "gui2/Container.h"
#include "State.h"
#include "TopLevelState.h"
+
+#ifdef __linux__
+#define THREADS 1
+#include <pthread.h>
+extern "C" void *dataCacheThread(void * arg);
+#endif
+
typedef enum
{
CURSOR_NORMAL,
@@ -55,6 +61,7 @@
void UpdateVideoMode(Uint16 w, Uint16 h, bool fullscreen);
private:
+// void *testis(void * arg);
void InitSettings();
void InitAudio();
void InitNet();
@@ -85,8 +92,3 @@
#endif // DUNE_APPLICATION_H
-
-
-
-
-
Modified: branches/dunks/src/Application.cpp
===================================================================
--- branches/dunks/src/Application.cpp 2008-04-30 00:57:00 UTC (rev 208)
+++ branches/dunks/src/Application.cpp 2008-04-30 01:05:18 UTC (rev 209)
@@ -35,15 +35,11 @@
#define VERSION "0.94.1"
-#ifdef __linux__
-# define _P __P
-#include <pthread.h>
+#ifdef THREADS
#include "DataCache.h"
-extern "C" void *dataCacheThread(void * arg);
-
void *dataCacheThread(void * arg)
{
- DataCache::Instance();
+ DataCache::Instance()->Init();
return NULL;
}
@@ -325,24 +321,10 @@
fprintf(stdout, "starting sound...\n");
SoundPlayerClass* soundPlayer = new SoundPlayerClass();
- //Mix_Chunk* myChunk = DataCache::Instance()->getMusic(MUSIC_INTRO, 0);
-// myChunk = DataCache::Instance()->getMusic(MUSIC_PEACE, 0);
-
- //soundPlayer->playSound(myChunk);
-}
-#if 0
-extern "C" void *testis(void * arg);
-
-void *testis(void * arg){
- fprintf(stdout, "starting sound...\n");
- SoundPlayerClass* soundPlayer = new SoundPlayerClass();
Mix_Chunk* myChunk = DataCache::Instance()->getMusic(MUSIC_INTRO, 0);
-// myChunk = DataCache::Instance()->getMusic(MUSIC_PEACE, 0);
-
soundPlayer->playSound(myChunk);
- return NULL;
}
-#endif
+
void Application::Die()
{
FontManager::Destroy();
Modified: branches/dunks/src/DataCache.cpp
===================================================================
--- branches/dunks/src/DataCache.cpp 2008-04-30 00:57:00 UTC (rev 208)
+++ branches/dunks/src/DataCache.cpp 2008-04-30 01:05:18 UTC (rev 209)
@@ -419,7 +419,7 @@
Mix_Chunk* DataCache::getMusic(MUSICTYPE musicType, uint16_t ID)
{
music::iterator iter;
-#ifdef __linux__
+#ifdef THREADS
spinlock:
#endif
iter = m_music[musicType]->find(ID);
@@ -429,7 +429,7 @@
}
else
{
-#ifdef __linux__
+#ifdef THREADS
goto spinlock;
#endif
return addMusic(musicType, ID);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|