finishing up my reformatting of the source from November/December following the guidelines that were posted. some extra things I added: * Any empty virtual declarations were kept to one line. * Enums were split up into separate lines to promote uniformity across all headers. ( each header file had a different style for enums)
52 lines
781 B
C++
52 lines
781 B
C++
#ifndef THREADING_H
|
|
#define THREADING_H
|
|
|
|
#if defined (WIN32) || defined (LINUX)
|
|
|
|
#include <boost/date_time.hpp>
|
|
#include <boost/thread.hpp>
|
|
|
|
#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
|