Improved performance of ImageData:mapPixel (now up to 2x as fast as in 0.8.0!); love.graphics.newImage, Image:refresh, love.window.setIcon, and ImageRasterizers now prevent other threads from modifying the ImageData used in those functions until they're done accessing it

This commit is contained in:
Alex Szpakowski
2013-06-25 05:28:20 -03:00
parent 8d7e0b5629
commit 6e3a7288dd
8 changed files with 191 additions and 28 deletions
+31
View File
@@ -42,6 +42,37 @@ Lock::~Lock()
mutex->unlock();
}
EmptyLock::EmptyLock()
: mutex(0)
{
}
EmptyLock::~EmptyLock()
{
if (mutex)
mutex->unlock();
}
void EmptyLock::setLock(Mutex *m)
{
if (mutex)
mutex->unlock();
mutex = m;
if (mutex)
mutex->lock();
}
void EmptyLock::setLock(Mutex &m)
{
if (mutex)
mutex->unlock();
mutex = &m;
mutex->lock();
}
Threadable::Threadable()
{
owner = newThread(this);
+13
View File
@@ -59,6 +59,19 @@ private:
Mutex *mutex;
};
class EmptyLock
{
public:
EmptyLock();
~EmptyLock();
void setLock(Mutex *m);
void setLock(Mutex &m);
private:
Mutex *mutex;
};
class Threadable
{
public: