rCriticalSection & rSemaphore removed
SC_Semaphore errors fixed Room for interrupt threads
This commit is contained in:
@@ -1,68 +1,5 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
rSemaphore::rSemaphore()
|
||||
{
|
||||
handle = reinterpret_cast<void*>(new wxSemaphore());
|
||||
}
|
||||
|
||||
rSemaphore::~rSemaphore()
|
||||
{
|
||||
delete reinterpret_cast<wxSemaphore*>(handle);
|
||||
}
|
||||
|
||||
rSemaphore::rSemaphore(int initial_count, int max_count)
|
||||
{
|
||||
handle = reinterpret_cast<void*>(new wxSemaphore(initial_count,max_count));
|
||||
}
|
||||
|
||||
void rSemaphore::Wait()
|
||||
{
|
||||
reinterpret_cast<wxSemaphore*>(handle)->Wait();
|
||||
}
|
||||
|
||||
rSemaStatus rSemaphore::TryWait()
|
||||
{
|
||||
wxSemaError err = reinterpret_cast<wxSemaphore*>(handle)->TryWait();
|
||||
if (err == wxSEMA_BUSY)
|
||||
{
|
||||
return rSEMA_BUSY;
|
||||
}
|
||||
else
|
||||
{
|
||||
return rSEMA_OTHER;
|
||||
}
|
||||
}
|
||||
|
||||
void rSemaphore::Post()
|
||||
{
|
||||
reinterpret_cast<wxSemaphore*>(handle)->Post();
|
||||
}
|
||||
|
||||
void rSemaphore::WaitTimeout(u64 timeout)
|
||||
{
|
||||
reinterpret_cast<wxSemaphore*>(handle)->WaitTimeout(timeout);
|
||||
}
|
||||
|
||||
rCriticalSection::rCriticalSection()
|
||||
{
|
||||
handle = reinterpret_cast<void*>(new wxCriticalSection());
|
||||
}
|
||||
|
||||
rCriticalSection::~rCriticalSection()
|
||||
{
|
||||
delete reinterpret_cast<wxCriticalSection*>(handle);
|
||||
}
|
||||
|
||||
void rCriticalSection::Enter()
|
||||
{
|
||||
reinterpret_cast<wxCriticalSection*>(handle)->Enter();
|
||||
}
|
||||
|
||||
void rCriticalSection::Leave()
|
||||
{
|
||||
reinterpret_cast<wxCriticalSection*>(handle)->Leave();
|
||||
}
|
||||
|
||||
rTimer::rTimer()
|
||||
{
|
||||
handle = reinterpret_cast<void*>(new wxTimer());
|
||||
@@ -93,17 +30,6 @@ void rMicroSleep(u64 time)
|
||||
wxMicroSleep(time);
|
||||
}
|
||||
|
||||
rCriticalSectionLocker::rCriticalSectionLocker(const rCriticalSection &sec)
|
||||
{
|
||||
handle = reinterpret_cast<void*>(new wxCriticalSectionLocker(*reinterpret_cast<wxCriticalSection*>(sec.handle)));
|
||||
}
|
||||
|
||||
|
||||
rCriticalSectionLocker::~rCriticalSectionLocker()
|
||||
{
|
||||
delete reinterpret_cast<wxCriticalSectionLocker*>(handle);
|
||||
}
|
||||
|
||||
bool rThread::IsMain()
|
||||
{
|
||||
return wxThread::IsMain();
|
||||
|
||||
@@ -1,34 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
enum rSemaStatus
|
||||
{
|
||||
rSEMA_BUSY,
|
||||
rSEMA_OTHER
|
||||
};
|
||||
struct rSemaphore
|
||||
{
|
||||
rSemaphore();
|
||||
rSemaphore(const rSemaphore& other) = delete;
|
||||
~rSemaphore();
|
||||
rSemaphore(int initial_count, int max_count);
|
||||
void Wait();
|
||||
rSemaStatus TryWait();
|
||||
void Post();
|
||||
void WaitTimeout(u64 timeout);
|
||||
private:
|
||||
void *handle;
|
||||
};
|
||||
|
||||
struct rCriticalSection
|
||||
{
|
||||
rCriticalSection();
|
||||
rCriticalSection(const rCriticalSection& other) = delete;
|
||||
~rCriticalSection();
|
||||
void Enter();
|
||||
void Leave();
|
||||
void *handle;
|
||||
};
|
||||
|
||||
struct rTimer
|
||||
{
|
||||
rTimer();
|
||||
@@ -43,14 +14,6 @@ private:
|
||||
void rSleep(u32 time);
|
||||
void rMicroSleep(u64 time);
|
||||
|
||||
struct rCriticalSectionLocker
|
||||
{
|
||||
rCriticalSectionLocker(const rCriticalSection& other);
|
||||
~rCriticalSectionLocker();
|
||||
private:
|
||||
void *handle;
|
||||
};
|
||||
|
||||
struct rThread
|
||||
{
|
||||
static bool IsMain();
|
||||
|
||||
Reference in New Issue
Block a user