Revision: 2400
http://rigsofrods.svn.sourceforge.net/rigsofrods/?rev=2400&view=rev
Author: rorthomas
Date: 2012-01-31 01:14:12 +0000 (Tue, 31 Jan 2012)
Log Message:
-----------
merged aave's linux patch - thanks
improved data locking
Modified Paths:
--------------
trunk/source/main/audio/SoundManager.h
trunk/source/main/framework/AdvancedOgreFramework.cpp
trunk/source/main/framework/ContentManager.cpp
trunk/source/main/gameplay/Savegame.cpp
trunk/source/main/gui/Console.cpp
trunk/source/main/gui/LobbyGUI.cpp
trunk/source/main/physics/Beam.cpp
trunk/source/main/physics/BeamFactory.cpp
trunk/source/main/physics/BeamWaitAndLock.h
Modified: trunk/source/main/audio/SoundManager.h
===================================================================
--- trunk/source/main/audio/SoundManager.h 2012-01-31 00:58:25 UTC (rev
2399)
+++ trunk/source/main/audio/SoundManager.h 2012-01-31 01:14:12 UTC (rev
2400)
@@ -62,7 +62,7 @@
void assign(int source_index, int hardware_index);
void retire(int source_index);
- bool SoundManager::loadWAVFile(Ogre::String filename, ALuint buffer);
+ bool loadWAVFile(Ogre::String filename, ALuint buffer);
// Active audio sources (hardware sources)
int m_hardware_sources_num;
// Total number of available hardware sources < MAX_HARDWARE_SOURCES
Modified: trunk/source/main/framework/AdvancedOgreFramework.cpp
===================================================================
--- trunk/source/main/framework/AdvancedOgreFramework.cpp 2012-01-31
00:58:25 UTC (rev 2399)
+++ trunk/source/main/framework/AdvancedOgreFramework.cpp 2012-01-31
01:14:12 UTC (rev 2400)
@@ -15,7 +15,7 @@
//|||||||||||||||||||||||||||||||||||||||||||||||
-template<> OgreFramework* Ogre::Singleton<OgreFramework>::ms_Singleton = 0;
+template<> OgreFramework* Ogre::Singleton<OgreFramework>::SINGLETON_MEMBER = 0;
//|||||||||||||||||||||||||||||||||||||||||||||||
Modified: trunk/source/main/framework/ContentManager.cpp
===================================================================
--- trunk/source/main/framework/ContentManager.cpp 2012-01-31 00:58:25 UTC
(rev 2399)
+++ trunk/source/main/framework/ContentManager.cpp 2012-01-31 01:14:12 UTC
(rev 2400)
@@ -44,7 +44,7 @@
using namespace Ogre;
using namespace std;
-template<> ContentManager* Ogre::Singleton<ContentManager>::ms_Singleton = 0;
+template<> ContentManager* Ogre::Singleton<ContentManager>::SINGLETON_MEMBER =
0;
ContentManager::ContentManager()
{
Modified: trunk/source/main/gameplay/Savegame.cpp
===================================================================
--- trunk/source/main/gameplay/Savegame.cpp 2012-01-31 00:58:25 UTC (rev
2399)
+++ trunk/source/main/gameplay/Savegame.cpp 2012-01-31 01:14:12 UTC (rev
2400)
@@ -23,6 +23,7 @@
#include "Savegame.h"
#include "BeamFactory.h"
+#include "BeamWaitAndLock.h"
#include "RoRVersion.h"
#include <Ogre.h>
@@ -55,7 +56,7 @@
FILE *f = fopen(filename.c_str(), "wb");
// wait for engine sync
- BeamWaitAndLock syncBeams();
+ BEAMLOCK();
// TODO: show error
if(!f)
@@ -223,7 +224,7 @@
FILE *f = fopen(filename.c_str(), "rb");
// wait for engine sync
- BeamWaitAndLock syncBeams();
+ BEAMLOCK();
if(!f)
{
Modified: trunk/source/main/gui/Console.cpp
===================================================================
--- trunk/source/main/gui/Console.cpp 2012-01-31 00:58:25 UTC (rev 2399)
+++ trunk/source/main/gui/Console.cpp 2012-01-31 01:14:12 UTC (rev 2400)
@@ -32,6 +32,7 @@
#include "Settings.h"
#include "RoRFrameListener.h"
#include "network.h"
+#include "heightfinder.h"
#include "Beam.h"
#include "BeamFactory.h"
Modified: trunk/source/main/gui/LobbyGUI.cpp
===================================================================
--- trunk/source/main/gui/LobbyGUI.cpp 2012-01-31 00:58:25 UTC (rev 2399)
+++ trunk/source/main/gui/LobbyGUI.cpp 2012-01-31 01:14:12 UTC (rev 2400)
@@ -427,7 +427,7 @@
void LobbyGUI::eventChangeTab(MyGUI::TabControl* _sender, size_t _index)
{
MyGUI::TabItemPtr tab = _sender->getItemAt(_index);
- String n = _sender->getItemNameAt(_index);
+ Ogre::String n = _sender->getItemNameAt(_index);
if(!tab) return;
if(tabs.find(n) == tabs.end())
return;
Modified: trunk/source/main/physics/Beam.cpp
===================================================================
--- trunk/source/main/physics/Beam.cpp 2012-01-31 00:58:25 UTC (rev 2399)
+++ trunk/source/main/physics/Beam.cpp 2012-01-31 01:14:12 UTC (rev 2400)
@@ -100,7 +100,7 @@
this->setMeshVisibility(false);
//block until all threads done
- BeamWaitAndLock beamSync();
+ BEAMLOCK();
// delete all classes we might have constructed
#ifdef USE_MYGUI
@@ -633,7 +633,7 @@
}
// wait for the thread(s) to be ready
- BeamWaitAndLock beamSync();
+ BEAMLOCK();
// all finished? so start network stuff
if (networked)
@@ -2113,7 +2113,7 @@
{
//block until all threads are done
{
- BeamWaitAndLock beamSync();
+ BEAMLOCK();
for (int t=0; t<numtrucks; t++)
{
if (!trucks[t]) continue;
@@ -2174,7 +2174,7 @@
void Beam::prepareShutdown()
{
- BeamWaitAndLock sync();
+ BEAMLOCK();
}
void Beam::sendStreamSetup()
Modified: trunk/source/main/physics/BeamFactory.cpp
===================================================================
--- trunk/source/main/physics/BeamFactory.cpp 2012-01-31 00:58:25 UTC (rev
2399)
+++ trunk/source/main/physics/BeamFactory.cpp 2012-01-31 01:14:12 UTC (rev
2400)
@@ -35,6 +35,7 @@
#include "gui_menu.h"
#include "DashBoardManager.h"
#endif // USE_MYGUI
+#include "BeamWaitAndLock.h"
using namespace Ogre;
@@ -336,7 +337,7 @@
bool BeamFactory::syncRemoteStreams()
{
// block until all threads done
- BeamWaitAndLock sync();
+ BEAMLOCK();
// we override this here, so we know if something changed and could
update the player list
// we delete and add trucks in there, so be sure that nothing runs as
we delete them ...
@@ -559,7 +560,7 @@
return;
// block until all threads done
- BeamWaitAndLock sync();
+ BEAMLOCK();
// synced delete
trucks[b->trucknum] = 0;
Modified: trunk/source/main/physics/BeamWaitAndLock.h
===================================================================
--- trunk/source/main/physics/BeamWaitAndLock.h 2012-01-31 00:58:25 UTC (rev
2399)
+++ trunk/source/main/physics/BeamWaitAndLock.h 2012-01-31 01:14:12 UTC (rev
2400)
@@ -23,6 +23,18 @@
#include "RoRPrerequisites.h"
#include "OgrePrerequisites.h"
+#include "BeamFactory.h"
+
+// helper macro that logs the locking place
+
+#ifdef FEAT_DEBUG_MUTEX
+# define BEAMLOCK() BeamWaitAndLock sync(__FILE__, __FUNCTION__, __LINE__)
+#else //!FEAT_DEBUG_MUTEX
+# define BEAMLOCK() BeamWaitAndLock sync(__FILE__, __FUNCTION__, __LINE__)
+//# define BEAMLOCK()
+#endif //FEAT_DEBUG_MUTEX
+
+
/**
* @brief helper class that locks the vehicles array during its lifetime
*/
@@ -36,8 +48,17 @@
{
BeamFactory::getSingleton()._waitForSyncAndLock();
}
-
+
/**
+ * constructor with logging
+ */
+ BeamWaitAndLock(const char *file, const char *function, int line)
+ {
+ LOG("Beam data locking in " + String(file) + " / " +
String(function) + ":" + TOSTRING(line));
+ BeamFactory::getSingleton()._waitForSyncAndLock();
+ }
+
+ /**
* destructor
*/
~BeamWaitAndLock()
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Rigsofrods-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rigsofrods-devel