2011-06-02 21:59:20 +02:00
|
|
|
// Copyright (c) 2008-2011 Raynaldo (Wildicv) Rivera, Joshua (Dark_Kilauea) Jones, Murat (wolfmanfx) Sari
|
2011-05-19 06:36:14 +02:00
|
|
|
// This file is part of the "cAudio Engine"
|
|
|
|
// For conditions of distribution and use, see copyright notice in cAudio.h
|
|
|
|
|
2011-05-29 20:33:24 +02:00
|
|
|
#pragma once
|
2011-05-19 06:36:14 +02:00
|
|
|
|
2011-06-05 21:23:53 +02:00
|
|
|
#include "cMutex.h"
|
|
|
|
#include "cAudioDefines.h"
|
|
|
|
#include "IThread.h"
|
2011-05-19 06:36:14 +02:00
|
|
|
|
2011-05-29 22:32:21 +02:00
|
|
|
#ifdef CAUDIO_PLATFORM_WIN
|
|
|
|
#include <windows.h> //Basic windows includes
|
|
|
|
#include <process.h>
|
|
|
|
#else
|
|
|
|
#include <pthread.h> //Assumed linux system
|
|
|
|
#endif
|
2011-05-19 06:36:14 +02:00
|
|
|
|
|
|
|
namespace cAudio
|
|
|
|
{
|
2011-05-29 22:32:21 +02:00
|
|
|
class cAudioThread : public IThread
|
2011-05-19 06:36:14 +02:00
|
|
|
{
|
|
|
|
public:
|
2011-05-29 22:32:21 +02:00
|
|
|
cAudioThread(IThreadWorker* pWorker);
|
|
|
|
~cAudioThread();
|
|
|
|
|
|
|
|
virtual bool start();
|
|
|
|
virtual void join();
|
|
|
|
virtual void shutdown();
|
|
|
|
virtual bool isRunning();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void updateLoop();
|
|
|
|
|
2011-05-19 06:36:14 +02:00
|
|
|
#ifdef CAUDIO_PLATFORM_WIN
|
2011-05-29 22:32:21 +02:00
|
|
|
static unsigned int __stdcall threadFunc(void *args);
|
|
|
|
HANDLE ThreadHandle;
|
2011-05-19 06:36:14 +02:00
|
|
|
#else
|
2011-05-29 22:32:21 +02:00
|
|
|
static void* threadFunc(void* args);
|
|
|
|
pthread_t ThreadHandle;
|
2011-05-19 06:36:14 +02:00
|
|
|
#endif
|
2011-05-29 22:32:21 +02:00
|
|
|
IThreadWorker* Worker;
|
|
|
|
unsigned int ThreadID;
|
|
|
|
cAudioMutex Mutex;
|
|
|
|
bool IsInit;
|
|
|
|
bool Loop;
|
2011-05-19 06:36:14 +02:00
|
|
|
};
|
2011-05-29 20:33:24 +02:00
|
|
|
};
|