mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-07-27 00:00:07 -06:00
first attempt at threading the 3D renderer
This commit is contained in:
@ -21,6 +21,11 @@
|
||||
#include <string.h>
|
||||
#include "../Platform.h"
|
||||
|
||||
#include <wx/wxprec.h>
|
||||
#ifndef WX_PRECOMP
|
||||
#include <wx/wx.h>
|
||||
#endif
|
||||
|
||||
#ifdef __WXMSW__
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
@ -46,6 +51,29 @@ namespace Platform
|
||||
{
|
||||
|
||||
|
||||
class Thread : public wxThread
|
||||
{
|
||||
public:
|
||||
Thread(void (*func)())
|
||||
: wxThread(wxTHREAD_JOINABLE)
|
||||
{
|
||||
this->Func = func;
|
||||
}
|
||||
|
||||
~Thread() {}
|
||||
|
||||
protected:
|
||||
virtual ExitCode Entry()
|
||||
{
|
||||
Func();
|
||||
return (ExitCode)0;
|
||||
}
|
||||
|
||||
private:
|
||||
void (*Func)();
|
||||
};
|
||||
|
||||
|
||||
socket_t MPSocket;
|
||||
sockaddr_t MPSendAddr;
|
||||
u8 PacketBuffer[2048];
|
||||
@ -53,6 +81,45 @@ u8 PacketBuffer[2048];
|
||||
#define NIFI_VER 1
|
||||
|
||||
|
||||
void* Thread_Create(void (*func)())
|
||||
{
|
||||
Thread* ret = new Thread(func);
|
||||
ret->Run();
|
||||
return (void*)ret;
|
||||
}
|
||||
|
||||
void Thread_Free(void* thread)
|
||||
{
|
||||
delete (Thread*)thread;
|
||||
}
|
||||
|
||||
void Thread_Wait(void* thread)
|
||||
{
|
||||
((Thread*)thread)->Wait();
|
||||
}
|
||||
|
||||
|
||||
void* Semaphore_Create()
|
||||
{
|
||||
return (void*)new wxSemaphore();
|
||||
}
|
||||
|
||||
void Semaphore_Free(void* sema)
|
||||
{
|
||||
delete (wxSemaphore*)sema;
|
||||
}
|
||||
|
||||
void Semaphore_Wait(void* sema)
|
||||
{
|
||||
((wxSemaphore*)sema)->Wait();
|
||||
}
|
||||
|
||||
void Semaphore_Post(void* sema)
|
||||
{
|
||||
((wxSemaphore*)sema)->Post();
|
||||
}
|
||||
|
||||
|
||||
bool MP_Init()
|
||||
{
|
||||
int opt_true = 1;
|
||||
|
Reference in New Issue
Block a user