mirror of
https://github.com/love2d/love.git
synced 2026-08-16 08:11:02 +02:00
Minor code cleanup
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
#define LOVE_THREAD_SDL_THREAD_H
|
||||
|
||||
// LOVE
|
||||
#include <thread/Thread.h>
|
||||
#include "thread/Thread.h"
|
||||
#include "threads.h"
|
||||
|
||||
// SDL
|
||||
@@ -34,6 +34,7 @@ namespace thread
|
||||
{
|
||||
namespace sdl
|
||||
{
|
||||
|
||||
class Thread : public thread::Thread
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -27,6 +27,7 @@ namespace thread
|
||||
{
|
||||
namespace sdl
|
||||
{
|
||||
|
||||
Mutex::Mutex()
|
||||
{
|
||||
mutex = SDL_CreateMutex();
|
||||
@@ -81,6 +82,11 @@ bool Conditional::wait(thread::Mutex *_mutex, int timeout)
|
||||
|
||||
} // sdl
|
||||
|
||||
|
||||
/**
|
||||
* Implementations of the functions declared in src/modules/threads.h.
|
||||
**/
|
||||
|
||||
thread::Mutex *newMutex()
|
||||
{
|
||||
return new sdl::Mutex();
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
#ifndef LOVE_THREAD_SDL_THREADS_H
|
||||
#define LOVE_THREAD_SDL_THREADS_H
|
||||
|
||||
#include <common/config.h>
|
||||
#include <thread/threads.h>
|
||||
#include "common/config.h"
|
||||
#include "thread/threads.h"
|
||||
|
||||
#include <SDL_thread.h>
|
||||
|
||||
@@ -32,11 +32,13 @@ namespace thread
|
||||
{
|
||||
namespace sdl
|
||||
{
|
||||
|
||||
class Conditional;
|
||||
|
||||
class Mutex : public thread::Mutex
|
||||
{
|
||||
public:
|
||||
|
||||
Mutex();
|
||||
~Mutex();
|
||||
|
||||
@@ -44,15 +46,18 @@ public:
|
||||
void unlock();
|
||||
|
||||
private:
|
||||
|
||||
SDL_mutex *mutex;
|
||||
Mutex(const Mutex&/* mutex*/) {}
|
||||
|
||||
friend class Conditional;
|
||||
};
|
||||
|
||||
}; // Mutex
|
||||
|
||||
class Conditional : public thread::Conditional
|
||||
{
|
||||
public:
|
||||
|
||||
Conditional();
|
||||
~Conditional();
|
||||
|
||||
@@ -61,8 +66,10 @@ public:
|
||||
bool wait(thread::Mutex *mutex, int timeout=-1);
|
||||
|
||||
private:
|
||||
|
||||
SDL_cond *cond;
|
||||
};
|
||||
|
||||
}; // Conditional
|
||||
|
||||
} // sdl
|
||||
} // thread
|
||||
|
||||
Reference in New Issue
Block a user