caudio/Headers/cThread.h
Joshua Jones 75ece68dcf Added cross-platform Mutex and Thread classes.
Made cAudio, cAudioCapture, cAudioManager and other classes thread safe.
Made cAudioManager use a seperate update thread by default.
Added cAudioSleep, a cross-platform sleep() function
Moved global defines to cAudioDefines
Added defines to disable thread safety or the internal update thread if the user wishes it
Updated tutorials to reflect the changes made
2009-08-29 11:24:31 +00:00

30 lines
906 B
C++

#ifndef CAUDIOTHREAD_H
#define CAUDIOTHREAD_H
#include "../include/cAudioDefines.h"
//Helper defines in order to make sure the function is declared right for use as a thread
#ifdef _WIN32
#define CAUDIO_DECLARE_THREAD_FUNCTION(functionName) unsigned __stdcall functionName( void* arguments )
#else
#define CAUDIO_DECLARE_THREAD_FUNCTION(functionName) void* functionName( void* arguments )
#endif
namespace cAudio
{
class cAudioThread
{
public:
// Really basic function to spawn a single detached thread
/** \param start_address The function you want to call
// \param arg Any arguments to pass to the function
// \return 0 if successful, otherwise an error */
#ifdef _WIN32
static int SpawnThread( unsigned __stdcall start_address( void* ), void *arg);
#else
static int SpawnThread( void* start_address( void* ), void *arg);
#endif
};
};
#endif //! CAUDIOTHREAD_H