caudio/Source/cAudioSleep.cpp
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

22 lines
464 B
C++

#ifdef _WIN32
#include <windows.h> //Basic windows include for Sleep();
#else
#include <unistd.h> //Assumed linux system, include for usleep()
#include <time.h>
#endif //If you need to support another platform, simply add a define for it
#include "../include/cAudioSleep.h"
namespace cAudio
{
void cAudioSleep(unsigned int ms)
{
#ifdef _WIN32
Sleep(ms);
#else
usleep(ms*1000); //convert from milliseconds to microseconds
#endif
}
};