diff options
Diffstat (limited to 'src/libjin/Thread/thread.cpp')
-rw-r--r-- | src/libjin/Thread/thread.cpp | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/src/libjin/Thread/thread.cpp b/src/libjin/Thread/thread.cpp index 13e691a..c2b7b91 100644 --- a/src/libjin/Thread/thread.cpp +++ b/src/libjin/Thread/thread.cpp @@ -1,5 +1,5 @@ #include "../modules.h" -#if JIN_MODULES_THREAD +#if LIBJIN_MODULES_THREAD #include "Thread.h" @@ -17,7 +17,7 @@ namespace thread void lock(); void unlock(); private: - #if JIN_THREAD_SDL + #if LIBJIN_THREAD_SDL SDL_mutex* mutex; #endif friend class Conditional; @@ -33,7 +33,7 @@ namespace thread void broadcast(); bool wait(Mutex* mutex, int timeout = -1); private: - #if JIN_THREAD_SDL + #if LIBJIN_THREAD_SDL SDL_cond* cond; #endif }; @@ -63,28 +63,28 @@ namespace thread Mutex::Mutex() { - #if JIN_THREAD_SDL + #if LIBJIN_THREAD_SDL mutex = SDL_CreateMutex(); #endif } Mutex::~Mutex() { - #if JIN_THREAD_SDL + #if LIBJIN_THREAD_SDL SDL_DestroyMutex(mutex); #endif } void Mutex::lock() { - #if JIN_THREAD_SDL + #if LIBJIN_THREAD_SDL SDL_LockMutex(mutex); #endif } void Mutex::unlock() { - #if JIN_THREAD_SDL + #if LIBJIN_THREAD_SDL SDL_UnlockMutex(mutex); #endif } @@ -93,35 +93,35 @@ namespace thread Conditional::Conditional() { - #if JIN_THREAD_SDL + #if LIBJIN_THREAD_SDL cond = SDL_CreateCond(); #endif } Conditional::~Conditional() { - #if JIN_THREAD_SDL + #if LIBJIN_THREAD_SDL SDL_DestroyCond(cond); #endif } void Conditional::signal() { - #if JIN_THREAD_SDL + #if LIBJIN_THREAD_SDL SDL_CondSignal(cond); #endif } void Conditional::broadcast() { - #if JIN_THREAD_SDL + #if LIBJIN_THREAD_SDL SDL_CondBroadcast(cond); #endif } bool Conditional::wait(Mutex* mutex, int timeout) { - #if JIN_THREAD_SDL + #if LIBJIN_THREAD_SDL if (timeout < 0) return !SDL_CondWait(cond, mutex->mutex); else @@ -183,7 +183,7 @@ namespace thread Thread::~Thread() { - #if JIN_THREAD_SDL + #if LIBJIN_THREAD_SDL #endif } @@ -206,13 +206,13 @@ namespace thread return false; if (handle) { - #if JIN_THREAD_SDL + #if LIBJIN_THREAD_SDL SDL_WaitThread(handle, nullptr); #endif } - #if JIN_THREAD_SDL + #if LIBJIN_THREAD_SDL handle = SDL_CreateThread(threadRunner, name.c_str(), p); - #elif JIN_THREAD_CPP + #elif LIBJIN_THREAD_CPP handle = new std::thread(); #endif return (running = (handle != nullptr)); @@ -225,7 +225,7 @@ namespace thread if (!handle) return; } - #if JIN_THREAD_SDL + #if LIBJIN_THREAD_SDL SDL_WaitThread(handle, nullptr); #endif Lock l(mutex); @@ -298,4 +298,4 @@ namespace thread } // thread } // jin -#endif // JIN_MODULES_THREAD
\ No newline at end of file +#endif // LIBJIN_MODULES_THREAD
\ No newline at end of file |