Merge branch 'master' of https://github.com/DigitalPulseSoftware/NazaraEngine
Former-commit-id: 7a27990f0e32319566a2c999b37ad0ab0ba3c611
This commit is contained in:
commit
53ae616d49
|
|
@ -11,7 +11,7 @@
|
|||
#elif defined(NAZARA_PLATFORM_POSIX)
|
||||
#include <Nazara/Core/Posix/ConditionVariableImpl.hpp>
|
||||
#else
|
||||
#error Thread condition has no implementation
|
||||
#error Condition variable has no implementation
|
||||
#endif
|
||||
|
||||
#include <Nazara/Core/Debug.hpp>
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@ namespace
|
|||
bool s_initialized = false;
|
||||
const unsigned int s_magic = 0xDEADB33FUL;
|
||||
const char* s_logFileName = "NazaraMemory.log";
|
||||
const char* s_nextFreeFile = "(Internal error)";
|
||||
unsigned int s_nextFreeLine = 0;
|
||||
thread_local const char* s_nextFreeFile = "(Internal error)";
|
||||
thread_local unsigned int s_nextFreeLine = 0;
|
||||
|
||||
Block s_list =
|
||||
{
|
||||
|
|
@ -235,6 +235,7 @@ void NzMemoryManager::Initialize()
|
|||
|
||||
#ifdef NAZARA_PLATFORM_WINDOWS
|
||||
InitializeCriticalSection(&s_mutex);
|
||||
//#elif defined(NAZARA_PLATFORM_POSIX) is already done in the namespace
|
||||
#endif
|
||||
|
||||
s_initialized = true;
|
||||
|
|
@ -250,6 +251,8 @@ void NzMemoryManager::Uninitialize()
|
|||
{
|
||||
#ifdef NAZARA_PLATFORM_WINDOWS
|
||||
DeleteCriticalSection(&s_mutex);
|
||||
#elif defined(NAZARA_PLATFORM_POSIX)
|
||||
pthread_mutex_destroy(&s_mutex);
|
||||
#endif
|
||||
|
||||
FILE* log = std::fopen(s_logFileName, "a");
|
||||
|
|
|
|||
|
|
@ -266,8 +266,8 @@ bool NzParameterList::GetUserdataParameter(const NzString& name, void** value) c
|
|||
}
|
||||
else
|
||||
{
|
||||
NazaraError("Parameter value is not an userdata");
|
||||
return nullptr;
|
||||
NazaraError("Parameter value is not a userdata");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ bool NzConditionVariableImpl::Wait(NzMutexImpl* mutex, nzUInt32 timeout)
|
|||
{
|
||||
// get the current time
|
||||
timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
gettimeofday(&tv, nullptr);
|
||||
|
||||
// construct the time limit (current time + time to wait)
|
||||
timespec ti;
|
||||
|
|
|
|||
|
|
@ -82,14 +82,15 @@ bool NzDirectoryImpl::Exists(const NzString& dirPath)
|
|||
NzString NzDirectoryImpl::GetCurrent()
|
||||
{
|
||||
NzString currentPath;
|
||||
char* path = new char[_PC_PATH_MAX];
|
||||
char* path = getcwd(nullptr, 0);
|
||||
|
||||
if (getcwd(path, _PC_PATH_MAX))
|
||||
if (path)
|
||||
{
|
||||
currentPath = path;
|
||||
free(path);
|
||||
}
|
||||
else
|
||||
NazaraError("Unable to get current directory: " + NzError::GetLastSystemError());
|
||||
|
||||
delete[] path;
|
||||
NazaraError("Unable to get current directory: " + NzError::GetLastSystemError()); // Bug: initialisation -> if no path for log !
|
||||
|
||||
return currentPath;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,11 @@
|
|||
|
||||
NzMutexImpl::NzMutexImpl()
|
||||
{
|
||||
pthread_mutex_init(&m_handle, NULL);
|
||||
pthread_mutexattr_t attr;
|
||||
pthread_mutexattr_init(&attr);
|
||||
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
|
||||
|
||||
pthread_mutex_init(&m_handle, &attr);
|
||||
}
|
||||
|
||||
NzMutexImpl::~NzMutexImpl()
|
||||
|
|
|
|||
|
|
@ -57,9 +57,9 @@ void NzThreadImpl::Sleep(nzUInt32 time)
|
|||
|
||||
// create a mutex and thread condition
|
||||
pthread_mutex_t mutex;
|
||||
pthread_mutex_init(&mutex, 0);
|
||||
pthread_mutex_init(&mutex, nullptr);
|
||||
pthread_cond_t condition;
|
||||
pthread_cond_init(&condition, 0);
|
||||
pthread_cond_init(&condition, nullptr);
|
||||
|
||||
// wait...
|
||||
pthread_mutex_lock(&mutex);
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
bool NzTaskSchedulerImpl::Initialize(unsigned int workerCount)
|
||||
{
|
||||
if (s_workerCount > 0)
|
||||
if (IsInitialized())
|
||||
return true; // Déjà initialisé
|
||||
|
||||
#if NAZARA_CORE_SAFE
|
||||
|
|
|
|||
Loading…
Reference in New Issue