Improved thread safety of love.event.wait and love.event.push

This commit is contained in:
Alex Szpakowski
2013-08-30 17:34:58 -03:00
parent 4584cf6780
commit d3826aba9d
2 changed files with 7 additions and 6 deletions
+5 -4
View File
@@ -55,22 +55,23 @@ EmptyLock::~EmptyLock()
void EmptyLock::setLock(Mutex *m)
{
if (m)
m->lock();
if (mutex)
mutex->unlock();
mutex = m;
if (mutex)
mutex->lock();
}
void EmptyLock::setLock(Mutex &m)
{
m.lock();
if (mutex)
mutex->unlock();
mutex = &m;
mutex->lock();
}
Threadable::Threadable()