Merge in channels from love-experiments

Rewritten love.thread and changed communication
method from weird system before, to channels.

--HG--
branch : minor
This commit is contained in:
Bart van Strien
2012-07-04 17:15:16 +02:00
parent e8ee7671c3
commit 399a6a6614
41 changed files with 1192 additions and 1580 deletions
+10 -2
View File
@@ -23,6 +23,8 @@
#include "sound/Decoder.h"
#include <cstdlib>
namespace love
{
namespace audio
@@ -34,9 +36,16 @@ Audio::PoolThread::PoolThread(Pool *pool)
: pool(pool)
, finish(false)
{
mutex = thread::newMutex();
}
void Audio::PoolThread::main()
Audio::PoolThread::~PoolThread()
{
delete mutex;
}
void Audio::PoolThread::threadFunction()
{
while (true)
{
@@ -59,7 +68,6 @@ void Audio::PoolThread::setFinish()
finish = true;
}
Audio::Audio() : distanceModel(DISTANCE_INVERSE_CLAMPED)
{
// Passing zero for default device.
+4 -4
View File
@@ -109,7 +109,7 @@ private:
// The Pool.
Pool *pool;
class PoolThread: public thread::ThreadBase
class PoolThread: public thread::Threadable
{
protected:
Pool *pool;
@@ -120,13 +120,13 @@ private:
volatile bool finish;
// finish lock
thread::Mutex mutex;
virtual void main();
thread::Mutex *mutex;
public:
PoolThread(Pool *pool);
~PoolThread();
void setFinish();
void threadFunction();
};
PoolThread *poolThread;
+1 -1
View File
@@ -35,7 +35,7 @@ Pool::Pool()
alGenSources(NUM_SOURCES, sources);
// Create the mutex.
mutex = new thread::Mutex();
mutex = thread::newMutex();
if (alGetError() != AL_NO_ERROR)
throw love::Exception("Could not generate sources.");