Forgot to follow coding standard...
This commit is contained in:
parent
e4904870b3
commit
48c812b033
|
@ -161,7 +161,6 @@
|
||||||
<ClInclude Include="Thread\IThreadObject.h" />
|
<ClInclude Include="Thread\IThreadObject.h" />
|
||||||
<ClInclude Include="Thread\OysterMutex.h" />
|
<ClInclude Include="Thread\OysterMutex.h" />
|
||||||
<ClInclude Include="Thread\OysterThread.h" />
|
<ClInclude Include="Thread\OysterThread.h" />
|
||||||
<ClInclude Include="Thread\OysterThread_Impl.h" />
|
|
||||||
<ClInclude Include="Utilities-InlineImpl.h" />
|
<ClInclude Include="Utilities-InlineImpl.h" />
|
||||||
<ClInclude Include="Utilities.h" />
|
<ClInclude Include="Utilities.h" />
|
||||||
<ClInclude Include="WinTimer.h" />
|
<ClInclude Include="WinTimer.h" />
|
||||||
|
|
|
@ -65,8 +65,5 @@
|
||||||
<ClInclude Include="Thread\OysterThread.h">
|
<ClInclude Include="Thread\OysterThread.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="Thread\OysterThread_Impl.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -1,3 +1,6 @@
|
||||||
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
// Created by [Dennis Andersen] [2013]
|
||||||
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include "..\OResource.h"
|
#include "..\OResource.h"
|
||||||
#include "..\..\Utilities.h"
|
#include "..\..\Utilities.h"
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
// Created by [Dennis Andersen] [2013]
|
||||||
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include "..\OResource.h"
|
#include "..\OResource.h"
|
||||||
#include "..\..\Utilities.h"
|
#include "..\..\Utilities.h"
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
// Created by [Dennis Andersen] [2013]
|
||||||
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include "OResource.h"
|
#include "OResource.h"
|
||||||
|
|
||||||
using namespace Oyster::Resource;
|
using namespace Oyster::Resource;
|
||||||
|
|
|
@ -60,7 +60,8 @@ OHRESOURCE OysterResource::LoadResource(const wchar_t filename[], CustomLoadFunc
|
||||||
|
|
||||||
if(!resourceData) return 0;
|
if(!resourceData) return 0;
|
||||||
|
|
||||||
if(resourceData) resourceData->SetResourceID(CustomId);
|
resourceData->SetResourceID(CustomId);
|
||||||
|
|
||||||
resourcePrivate.SaveResource(resourceData);
|
resourcePrivate.SaveResource(resourceData);
|
||||||
|
|
||||||
return (OHRESOURCE)resourceData->GetResourceHandle();
|
return (OHRESOURCE)resourceData->GetResourceHandle();
|
||||||
|
|
|
@ -13,7 +13,9 @@ namespace Oyster
|
||||||
struct CustomData;
|
struct CustomData;
|
||||||
/** A Resource handle representing various resources */
|
/** A Resource handle representing various resources */
|
||||||
typedef unsigned long OHRESOURCE;
|
typedef unsigned long OHRESOURCE;
|
||||||
|
/** Typedef on a fuction required for custom unloading */
|
||||||
typedef void(*CustomUnloadFunction)(void* loadedData);
|
typedef void(*CustomUnloadFunction)(void* loadedData);
|
||||||
|
/** Typedef on a fuction required for custom loading */
|
||||||
typedef const CustomData&(*CustomLoadFunction)(const wchar_t filename[]);
|
typedef const CustomData&(*CustomLoadFunction)(const wchar_t filename[]);
|
||||||
|
|
||||||
/** An enum class representing all avalible resources that is supported. */
|
/** An enum class representing all avalible resources that is supported. */
|
||||||
|
@ -26,7 +28,7 @@ namespace Oyster
|
||||||
ResourceType_Byte_UNICODE, /**< Handle can be interpeted as char[] or char* */
|
ResourceType_Byte_UNICODE, /**< Handle can be interpeted as char[] or char* */
|
||||||
ResourceType_Byte_UTF16LE, /**< Handle can be interpeted as char[] or char* */
|
ResourceType_Byte_UTF16LE, /**< Handle can be interpeted as char[] or char* */
|
||||||
|
|
||||||
ResourceType_COUNT, /**< Handle can be interpeted as ? */
|
ResourceType_COUNT, /**< Not used. */
|
||||||
|
|
||||||
ResourceType_UNKNOWN = -1, /**< Handle can be interpeted as void* */
|
ResourceType_UNKNOWN = -1, /**< Handle can be interpeted as void* */
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
// Created by [Dennis Andersen] [2013]
|
||||||
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef MISC_I_THREAD_OBJECT_H
|
#ifndef MISC_I_THREAD_OBJECT_H
|
||||||
#define MISC_I_THREAD_OBJECT_H
|
#define MISC_I_THREAD_OBJECT_H
|
||||||
|
|
||||||
|
@ -12,22 +16,22 @@ namespace Oyster
|
||||||
*/
|
*/
|
||||||
class IThreadObject
|
class IThreadObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* Override this to get notified when the thread is started.
|
* Override this to get notified when the thread is started.
|
||||||
*/
|
*/
|
||||||
virtual void ThreadEntry() { }
|
virtual void ThreadEntry() { }
|
||||||
/**
|
/**
|
||||||
* Override this to get notified when the thread is about to exit.
|
* Override this to get notified when the thread is about to exit.
|
||||||
*/
|
*/
|
||||||
virtual void ThreadExit() { }
|
virtual void ThreadExit() { }
|
||||||
/**
|
/**
|
||||||
* This function is required to get threading working.
|
* This function is required to get threading working.
|
||||||
*/
|
*/
|
||||||
virtual bool DoWork ( ) = 0;
|
virtual bool DoWork ( ) = 0;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // !MISC_I_WORKER_THREAD_H
|
#endif // !MISC_I_THREAD_OBJECT_H
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
// Created by [Dennis Andersen] [2013]
|
||||||
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include "OysterMutex.h"
|
#include "OysterMutex.h"
|
||||||
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
// Created by [Dennis Andersen] [2013]
|
||||||
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef MISC_OYSTER_MUTEX_H
|
#ifndef MISC_OYSTER_MUTEX_H
|
||||||
#define MISC_OYSTER_MUTEX_H
|
#define MISC_OYSTER_MUTEX_H
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
// Created by [Dennis Andersen] [2013]
|
||||||
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef MISC_OYSTER_THREAD_H
|
#ifndef MISC_OYSTER_THREAD_H
|
||||||
#define MISC_OYSTER_THREAD_H
|
#define MISC_OYSTER_THREAD_H
|
||||||
|
|
||||||
|
@ -42,4 +46,4 @@ namespace Oyster
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // !MISC_I_OYSTER_THREAD_H
|
#endif // !MISC_OYSTER_THREAD_H
|
||||||
|
|
|
@ -1,8 +1,12 @@
|
||||||
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
// Created by [Dennis Andersen] [2013]
|
||||||
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include "OysterThread.h"
|
#include "OysterThread.h"
|
||||||
#include <thread>
|
|
||||||
#include "OysterMutex.h"
|
#include "OysterMutex.h"
|
||||||
#include <assert.h>
|
|
||||||
#include "..\Utilities.h"
|
#include "..\Utilities.h"
|
||||||
|
#include <thread>
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
using namespace Oyster::Thread;
|
using namespace Oyster::Thread;
|
||||||
using namespace Utility::DynamicMemory::SmartPointer;
|
using namespace Utility::DynamicMemory::SmartPointer;
|
||||||
|
@ -141,31 +145,6 @@ OYSTER_THREAD_ERROR OysterThread::Create(IThreadObject* worker, bool start)
|
||||||
|
|
||||||
ThreadFunction fnc = ThreadingFunction;
|
ThreadFunction fnc = ThreadingFunction;
|
||||||
|
|
||||||
/*
|
|
||||||
//Create a lambda function with current worker instance to fire of the thread
|
|
||||||
#if defined(DEBUG) || defined (_DEBUG)
|
|
||||||
ThreadFunction fnc = [](ThreadData* w) -> void
|
|
||||||
{
|
|
||||||
while(w->state == OYSTER_THREAD_STATE_STOPED);
|
|
||||||
|
|
||||||
w->owner->ThreadEntry();
|
|
||||||
while (true)
|
|
||||||
{
|
|
||||||
w->mutexLock.LockMutex();
|
|
||||||
w->owner->DoWork();
|
|
||||||
w->mutexLock.UnlockMutex();
|
|
||||||
}
|
|
||||||
w->mutexLock.LockMutex();
|
|
||||||
w->owner->ThreadExit();
|
|
||||||
w->mutexLock.UnlockMutex();
|
|
||||||
};
|
|
||||||
|
|
||||||
#else
|
|
||||||
ThreadFunction fnc = ThreadingFunction;
|
|
||||||
//ThreadFunction fnc = THREAD_LAMBDA_FUNCTION_CREATION;
|
|
||||||
#endif
|
|
||||||
*/
|
|
||||||
|
|
||||||
//Maby move this thread creation to a seperate Start() function because std::thread fires the thread when it is created. :(
|
//Maby move this thread creation to a seperate Start() function because std::thread fires the thread when it is created. :(
|
||||||
this->privateData->threadData->workerThread = new std::thread(fnc, this->privateData->threadData);
|
this->privateData->threadData->workerThread = new std::thread(fnc, this->privateData->threadData);
|
||||||
|
|
||||||
|
|
|
@ -1,41 +0,0 @@
|
||||||
#ifndef INCLUDE_GUARD_OYSTER_THREAD_H
|
|
||||||
#define INCLUDE_GUARD_OYSTER_THREAD_H
|
|
||||||
|
|
||||||
#include "IOysterThread.h"
|
|
||||||
#include <thread>
|
|
||||||
|
|
||||||
namespace Oyster
|
|
||||||
{
|
|
||||||
namespace Thread
|
|
||||||
{
|
|
||||||
//class OysterThread :public IOysterThread
|
|
||||||
//{
|
|
||||||
//private:
|
|
||||||
// std::thread thread; //<! The worker thread.
|
|
||||||
// IWorkerThread *owner; //<! The owner of the thread as IThread
|
|
||||||
//
|
|
||||||
//public:
|
|
||||||
// bool Wait();
|
|
||||||
// bool Suspend();
|
|
||||||
// void Resume();
|
|
||||||
// bool Kill();
|
|
||||||
// bool IsActive();
|
|
||||||
// bool Reset();
|
|
||||||
// bool StartThread()
|
|
||||||
// {
|
|
||||||
// this->owner->ThreadEntry();
|
|
||||||
//
|
|
||||||
// while (true)
|
|
||||||
// {
|
|
||||||
// this->owner->DoWork();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// this->owner->ThreadExit();
|
|
||||||
// }
|
|
||||||
//};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif // !INCLUDE_GUARD_OYSTER_THREAD_H
|
|
Loading…
Reference in New Issue