Minor code cleanup

This commit is contained in:
Alex Szpakowski
2014-05-01 14:12:21 -03:00
parent e667485f68
commit e4dc533bb2
26 changed files with 112 additions and 110 deletions
+8 -2
View File
@@ -26,13 +26,14 @@
#include <string>
// LOVE
#include <common/Variant.h>
#include <thread/threads.h>
#include "common/Variant.h"
#include "threads.h"
namespace love
{
namespace thread
{
class Channel : public love::Object
{
// FOR WRAPPER USE ONLY
@@ -40,8 +41,10 @@ friend void retainVariant(Channel *, Variant *);
friend void releaseVariant(Channel *, Variant *);
public:
Channel();
~Channel();
static Channel *getChannel(const std::string &name);
unsigned long push(Variant *var);
@@ -56,6 +59,7 @@ public:
void release();
private:
Channel(const std::string &name);
void lockMutex();
void unlockMutex();
@@ -68,7 +72,9 @@ private:
unsigned long sent;
unsigned long received;
}; // Channel
} // thread
} // love
+8 -5
View File
@@ -25,15 +25,16 @@
#include <string>
// LOVE
#include <common/Data.h>
#include <common/Object.h>
#include <common/Variant.h>
#include <thread/threads.h>
#include "common/Data.h"
#include "common/Object.h"
#include "common/Variant.h"
#include "threads.h"
namespace love
{
namespace thread
{
class LuaThread : public love::Object, public Threadable
{
public:
@@ -55,7 +56,9 @@ private:
Variant **args;
int nargs;
};
}; // LuaThread
} // thread
} // love
+2 -2
View File
@@ -22,8 +22,8 @@
#define LOVE_THREAD_THREAD_H
// LOVE
#include <common/runtime.h>
#include <common/Object.h>
#include "common/runtime.h"
#include "common/Object.h"
namespace love
{
+2 -1
View File
@@ -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:
+6
View File
@@ -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();
+11 -4
View File
@@ -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
+1 -1
View File
@@ -21,7 +21,7 @@
#ifndef LOVE_THREAD_THREADS_H
#define LOVE_THREAD_THREADS_H
#include <common/config.h>
#include "common/config.h"
#include "Thread.h"
namespace love