remove ProtAllocator hack

This commit is contained in:
Glenn Maynard
2004-10-15 21:44:23 +00:00
parent a9fb4cc62a
commit 433827c2de
2 changed files with 1 additions and 89 deletions
-27
View File
@@ -12,26 +12,6 @@
#include "arch/arch.h"
#include "arch/Sound/RageSoundDriver.h"
#if defined(_MSC_VER) && _MSC_VER >= 1300
set<void *> g_ProtectedPages;
void EnableWrites()
{
DWORD ignore;
for( set<void *>::iterator it = g_ProtectedPages.begin(); it != g_ProtectedPages.end(); ++it )
VirtualProtect( *it, 4096, PAGE_READWRITE, &ignore );
}
void DisableWrites()
{
DWORD ignore;
for( set<void *>::iterator it = g_ProtectedPages.begin(); it != g_ProtectedPages.end(); ++it )
VirtualProtect( *it, 4096, PAGE_READONLY, &ignore );
}
#else
void EnableWrites() { }
void DisableWrites() { }
#endif
/*
* This mutex is locked before Update() deletes old sounds from owned_sounds. Lock
* this mutex if you want to ensure that sounds remain valid. (Other threads may
@@ -56,7 +36,6 @@ RageSoundManager::RageSoundManager()
{
pos_map_queue.reserve( 1024 );
MixVolume = 1.0f;
DisableWrites();
}
void RageSoundManager::Init( CString drivers )
@@ -79,8 +58,6 @@ RageSoundManager::~RageSoundManager()
/* Don't lock while deleting the driver (the decoder thread might deadlock). */
delete driver;
EnableWrites(); /* for dtor */
}
void RageSoundManager::StartMixing( RageSoundBase *snd )
@@ -144,18 +121,14 @@ void RageSoundManager::Update(float delta)
void RageSoundManager::RegisterSound( RageSound *p )
{
g_SoundManMutex.Lock(); /* lock for access to all_sounds */
EnableWrites();
all_sounds.insert( p );
DisableWrites();
g_SoundManMutex.Unlock(); /* finished with all_sounds */
}
void RageSoundManager::UnregisterSound( RageSound *p )
{
g_SoundManMutex.Lock(); /* lock for access to all_sounds */
EnableWrites();
all_sounds.erase( p );
DisableWrites();
g_SoundManMutex.Unlock(); /* finished with all_sounds */
}