Update to purify v02r01 release.

Because byuu's Win32 compiler does not yet support the C++11 std::thread
API, he wrote his own portable wrapper library, so now the new purify
works on Windows too.
This commit is contained in:
Tim Allen 2013-01-19 22:20:25 +11:00
parent b6575ca02a
commit ba660600ad
5 changed files with 55 additions and 4 deletions

3
.gitignore vendored
View File

@ -1,2 +1,5 @@
purify/purify
purify/ananke.dll
purify/phoenix.dll
purify/purify.exe
ananke/libananke.so

View File

@ -8,6 +8,8 @@ objects := obj/phoenix.o obj/purify.o
ifeq ($(platform),x)
link += -Wl,-export-dynamic
else ifeq ($(platform),win)
link += -mwindows
endif
all: build;
@ -22,8 +24,9 @@ build: $(objects)
ifeq ($(platform),x)
$(cpp) $(link) -o purify $(objects) $(phoenixlink)
else ifeq ($(platform),win)
windres phoenix/windows/phoenix.rc obj/phoenix-resource.o
$(cpp) -shared -o phoenix.dll obj/phoenix.o $(phoenixlink)
$(cpp) -o purify obj/purify.o $(link) -L. -lphoenix
$(cpp) -o purify obj/purify.o obj/phoenix-resource.o $(link) -L. -lphoenix
endif
resource: force

View File

@ -39,6 +39,7 @@
#include <nall/stdint.hpp>
#include <nall/stream.hpp>
#include <nall/string.hpp>
#include <nall/thread.hpp>
#include <nall/traits.hpp>
#include <nall/unzip.hpp>
#include <nall/utility.hpp>

46
purify/nall/thread.hpp Normal file
View File

@ -0,0 +1,46 @@
#ifndef NALL_THREAD_HPP
#define NALL_THREAD_HPP
#include <nall/platform.hpp>
#include <nall/function.hpp>
#include <nall/intrinsics.hpp>
#if defined(PLATFORM_X) || defined(PLATFORM_OSX)
#include <thread>
#elif defined(PLATFORM_WIN)
//TDM/GCC 4.7 does not support std::thread
//implement an extremely lightweight wrapper
namespace std {
inline DWORD WINAPI thread_entry_point(LPVOID parameter);
struct thread {
bool joinable() const {
return active == false;
}
void join() {
while(active) usleep(1);
}
thread(function<void ()> entryPoint) : entryPoint(entryPoint), active(true) {
CreateThread(NULL, 0, thread_entry_point, (void*)this, 0, NULL);
}
private:
function<void ()> entryPoint;
bool active;
friend DWORD WINAPI thread_entry_point(LPVOID);
};
inline DWORD WINAPI thread_entry_point(LPVOID parameter) {
thread *context = (thread*)parameter;
context->entryPoint();
context->active = false;
return 0;
}
}
#endif
#endif

View File

@ -4,8 +4,6 @@ using namespace nall;
#include <phoenix/phoenix.hpp>
using namespace phoenix;
#include <thread>
#include "resource/resource.cpp"
struct Application : Window {
@ -44,7 +42,7 @@ Application::Application() {
}
setFrameGeometry({64, 64, 720, 480});
setTitle("purify v02");
setTitle("purify v02.01");
layout.setMargin(5);
pathLabel.setText("Path:");