mirror of
https://github.com/love2d/love.git
synced 2026-08-12 08:30:56 +02:00
Merge default into minor
--HG-- branch : minor
This commit is contained in:
@@ -131,7 +131,7 @@ private:
|
||||
|
||||
public:
|
||||
PoolThread(Pool *pool);
|
||||
~PoolThread();
|
||||
virtual ~PoolThread();
|
||||
void setFinish();
|
||||
void threadFunction();
|
||||
};
|
||||
|
||||
@@ -43,7 +43,6 @@ LuaThread::~LuaThread()
|
||||
|
||||
void LuaThread::threadFunction()
|
||||
{
|
||||
this->retain();
|
||||
error.clear();
|
||||
|
||||
lua_State *L = luaL_newstate();
|
||||
@@ -83,8 +82,6 @@ void LuaThread::threadFunction()
|
||||
|
||||
if (!error.empty())
|
||||
onError();
|
||||
|
||||
this->release();
|
||||
}
|
||||
|
||||
bool LuaThread::start(const std::vector<Variant> &args)
|
||||
|
||||
@@ -36,12 +36,12 @@ namespace love
|
||||
namespace thread
|
||||
{
|
||||
|
||||
class LuaThread : public love::Object, public Threadable
|
||||
class LuaThread : public Threadable
|
||||
{
|
||||
public:
|
||||
|
||||
LuaThread(const std::string &name, love::Data *code);
|
||||
~LuaThread();
|
||||
virtual ~LuaThread();
|
||||
void threadFunction();
|
||||
const std::string &getError() const;
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace sdl
|
||||
Thread::Thread(Threadable *t)
|
||||
: t(t)
|
||||
, running(false)
|
||||
, thread(0)
|
||||
, thread(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -74,9 +74,16 @@ bool Thread::isRunning()
|
||||
int Thread::thread_runner(void *data)
|
||||
{
|
||||
Thread *self = (Thread *) data; // some compilers don't like 'this'
|
||||
self->t->retain();
|
||||
|
||||
self->t->threadFunction();
|
||||
Lock l(self->mutex);
|
||||
self->running = false;
|
||||
|
||||
{
|
||||
Lock l(self->mutex);
|
||||
self->running = false;
|
||||
}
|
||||
|
||||
self->t->release();
|
||||
return 0;
|
||||
}
|
||||
} // sdl
|
||||
|
||||
@@ -76,7 +76,7 @@ private:
|
||||
Mutex *mutex;
|
||||
};
|
||||
|
||||
class Threadable
|
||||
class Threadable : public love::Object
|
||||
{
|
||||
public:
|
||||
Threadable();
|
||||
|
||||
@@ -43,7 +43,7 @@ class Video : public love::video::Video
|
||||
{
|
||||
public:
|
||||
Video();
|
||||
~Video();
|
||||
virtual ~Video();
|
||||
|
||||
// Implements Module
|
||||
virtual const char *getName() const;
|
||||
@@ -58,7 +58,7 @@ class Worker : public love::thread::Threadable
|
||||
{
|
||||
public:
|
||||
Worker();
|
||||
~Worker();
|
||||
virtual ~Worker();
|
||||
|
||||
// Implements Threadable
|
||||
void threadFunction();
|
||||
|
||||
Reference in New Issue
Block a user