#include "stdafx.h" rSemaphore::rSemaphore() { handle = reinterpret_cast(new wxSemaphore()); } rSemaphore::~rSemaphore() { delete reinterpret_cast(handle); } rSemaphore::rSemaphore(int initial_count, int max_count) { handle = reinterpret_cast(new wxSemaphore(initial_count,max_count)); } void rSemaphore::Wait() { reinterpret_cast(handle)->Wait(); } rSemaStatus rSemaphore::TryWait() { wxSemaError err = reinterpret_cast(handle)->TryWait(); if (err == wxSEMA_BUSY) { return rSEMA_BUSY; } else { return rSEMA_OTHER; } } void rSemaphore::Post() { reinterpret_cast(handle)->Post(); } void rSemaphore::WaitTimeout(u64 timeout) { reinterpret_cast(handle)->WaitTimeout(timeout); } rCriticalSection::rCriticalSection() { handle = reinterpret_cast(new wxCriticalSection()); } rCriticalSection::~rCriticalSection() { delete reinterpret_cast(handle); } void rCriticalSection::Enter() { reinterpret_cast(handle)->Enter(); } void rCriticalSection::Leave() { reinterpret_cast(handle)->Leave(); } rTimer::rTimer() { handle = reinterpret_cast(new wxTimer()); } rTimer::~rTimer() { delete reinterpret_cast(handle); } void rTimer::Start() { reinterpret_cast(handle)->Start(); } void rTimer::Stop() { reinterpret_cast(handle)->Stop(); } void rSleep(u32 time) { wxSleep(time); } void rMicroSleep(u64 time) { wxMicroSleep(time); } rCriticalSectionLocker::rCriticalSectionLocker(const rCriticalSection &sec) { handle = reinterpret_cast(new wxCriticalSectionLocker(*reinterpret_cast(sec.handle))); } rCriticalSectionLocker::~rCriticalSectionLocker() { delete reinterpret_cast(handle); } bool rThread::IsMain() { return wxThread::IsMain(); } void rYieldIfNeeded() { wxYieldIfNeeded(); }