aboutsummaryrefslogtreecommitdiff
path: root/src/wx
diff options
context:
space:
mode:
Diffstat (limited to 'src/wx')
-rw-r--r--src/wx/Platform.cpp67
1 files changed, 67 insertions, 0 deletions
diff --git a/src/wx/Platform.cpp b/src/wx/Platform.cpp
index 61aa96e..1fb4373 100644
--- a/src/wx/Platform.cpp
+++ b/src/wx/Platform.cpp
@@ -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;