diff --git a/projects/mtg/include/Threading.h b/projects/mtg/include/Threading.h new file mode 100644 index 000000000..179370b09 --- /dev/null +++ b/projects/mtg/include/Threading.h @@ -0,0 +1,51 @@ +#ifndef THREADING_H +#define THREADING_H + + +#if defined (WIN32) || defined (LINUX) + +#include +#include + +#else +#include "pspthreadman.h" + +namespace boost +{ + + class mutex + { + public: + struct scoped_lock + { + scoped_lock(mutex& inMutex) : mID(inMutex.mID) + { + sceKernelWaitSema(mID, 1, 0); + } + + ~scoped_lock() + { + sceKernelSignalSema(mID, 1); + } + + int mID; + }; + + mutex() + { + mID = sceKernelCreateSema("Unnamed", 0, 1, 1, 0); + } + + ~mutex() + { + sceKernelDeleteSema(mID); + } + + int mID; + }; + +} + +#endif + +#endif // THREADING_H \ No newline at end of file