mirror of
https://github.com/love2d/love.git
synced 2026-08-16 00:02:12 +02:00
Added Thread:isRunning
This commit is contained in:
@@ -68,6 +68,12 @@ void Thread::wait()
|
||||
thread = 0;
|
||||
}
|
||||
|
||||
bool Thread::isRunning()
|
||||
{
|
||||
Lock l(mutex);
|
||||
return running;
|
||||
}
|
||||
|
||||
int Thread::thread_runner(void *data)
|
||||
{
|
||||
Thread *self = (Thread *) data; // some compilers don't like 'this'
|
||||
|
||||
@@ -36,19 +36,25 @@ namespace sdl
|
||||
{
|
||||
class Thread : public thread::Thread
|
||||
{
|
||||
private:
|
||||
Threadable *t;
|
||||
bool running;
|
||||
SDL_Thread *thread;
|
||||
static int thread_runner(void *data);
|
||||
Mutex mutex;
|
||||
|
||||
public:
|
||||
|
||||
Thread(Threadable *t);
|
||||
~Thread();
|
||||
bool start();
|
||||
void wait();
|
||||
bool isRunning();
|
||||
|
||||
private:
|
||||
|
||||
Threadable *t;
|
||||
bool running;
|
||||
SDL_Thread *thread;
|
||||
Mutex mutex;
|
||||
|
||||
static int thread_runner(void *data);
|
||||
|
||||
}; // Thread
|
||||
|
||||
} // sdl
|
||||
} // thread
|
||||
} // love
|
||||
|
||||
Reference in New Issue
Block a user