GSdx: Fixed Software-mode crash on Escape/Exit, caused by a couple destructor race conditions. (C++ destructors and thread safety are fickle beasts that like to claw each others' eyes out)

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1371 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
Jake.Stine 2009-06-15 23:21:17 +00:00
parent ce4b58ba61
commit c60095f6b0
4 changed files with 18 additions and 2 deletions

View File

@ -32,6 +32,7 @@ GPURendererSW::GPURendererSW(GSDevice* dev)
GPURendererSW::~GPURendererSW()
{
m_rl.Terminate();
}
void GPURendererSW::ResetDevice()

View File

@ -823,9 +823,12 @@ GSRasterizerMT::GSRasterizerMT(IDrawScanline* ds, int id, int threads, long* syn
}
}
GSRasterizerMT::~GSRasterizerMT()
GSRasterizerMT::~GSRasterizerMT() {}
void GSRasterizerMT::Terminate()
{
m_exit = true;
CloseThread();
}
void GSRasterizerMT::Draw(const GSRasterizerData* data)
@ -877,8 +880,14 @@ GSRasterizerList::GSRasterizerList()
GSRasterizerList::~GSRasterizerList()
{
_aligned_free(m_sync);
}
FreeRasterizers();
void GSRasterizerList::Terminate()
{
for(list<IRasterizer*>::iterator i = begin(); i != end(); i++)
{
(*i)->Terminate();
}
}
void GSRasterizerList::FreeRasterizers()

View File

@ -43,6 +43,7 @@ public:
virtual void Draw(const GSRasterizerData* data) = 0;
virtual void GetStats(GSRasterizerStats& stats) = 0;
virtual void Terminate() = 0;
virtual void PrintStats() = 0;
};
@ -101,6 +102,7 @@ public:
void Draw(const GSRasterizerData* data);
void GetStats(GSRasterizerStats& stats);
void PrintStats() {m_ds->PrintStats();}
void Terminate() {}
};
class GSRasterizerMT : public GSRasterizer, private GSThread
@ -118,6 +120,7 @@ public:
// IRasterizer
void Draw(const GSRasterizerData* data);
void Terminate();
};
class GSRasterizerList : protected list<IRasterizer*>, public IRasterizer
@ -148,4 +151,5 @@ public:
void Draw(const GSRasterizerData* data);
void GetStats(GSRasterizerStats& stats);
void PrintStats();
void Terminate();
};

View File

@ -38,6 +38,8 @@ GSRendererSW::GSRendererSW(uint8* base, bool mt, void (*irq)(), GSDevice* dev)
GSRendererSW::~GSRendererSW()
{
m_rl.Terminate();
delete m_tc;
}