Merge remote-tracking branch 'upstream/master'

Former-commit-id: 124b89e1c31a7b907f88d8c7a234473274d5a0f6
This commit is contained in:
Gawaboumga
2014-06-28 09:05:16 +02:00
14 changed files with 14 additions and 125 deletions

View File

@@ -44,13 +44,13 @@ void NzError::Error(nzErrorType type, const NzString& error, unsigned int line,
s_lastErrorFunction = function;
s_lastErrorLine = line;
if (type != nzErrorType_Warning && (s_flags & nzErrorFlag_ThrowException) != 0 && (s_flags & nzErrorFlag_ThrowExceptionDisabled) == 0)
throw std::runtime_error(error);
#if NAZARA_CORE_EXIT_ON_ASSERT_FAILURE
if (type == nzErrorType_AssertFailed)
std::exit(EXIT_FAILURE);
#endif
if (type != nzErrorType_Warning && (s_flags & nzErrorFlag_ThrowException) != 0 && (s_flags & nzErrorFlag_ThrowExceptionDisabled) == 0)
throw std::runtime_error(error);
}
nzUInt32 NzError::GetFlags()

View File

@@ -10,7 +10,7 @@
NzSemaphoreImpl::NzSemaphoreImpl(unsigned int count)
{
m_semaphore = CreateSemaphore(nullptr, count, std::numeric_limits<LONG>::max(), nullptr);
m_semaphore = CreateSemaphoreW(nullptr, count, std::numeric_limits<LONG>::max(), nullptr);
if (!m_semaphore)
NazaraError("Failed to create semaphore: " + NzError::GetLastSystemError());
}

View File

@@ -34,11 +34,11 @@ bool NzTaskSchedulerImpl::Initialize(unsigned int workerCount)
{
Worker& worker = s_workers[i];
InitializeCriticalSection(&worker.queueMutex);
worker.wakeEvent = CreateEventA(nullptr, false, false, nullptr);
worker.wakeEvent = CreateEventW(nullptr, false, false, nullptr);
worker.running = true;
worker.workCount = 0;
s_doneEvents[i] = CreateEventA(nullptr, true, false, nullptr);
s_doneEvents[i] = CreateEventW(nullptr, true, false, nullptr);
workerIDs[i] = i;
s_workerThreads[i] = reinterpret_cast<HANDLE>(_beginthreadex(nullptr, 0, &WorkerProc, &workerIDs[i], 0, nullptr));
@@ -149,7 +149,8 @@ NzFunctor* NzTaskSchedulerImpl::StealTask(unsigned int workerID)
if (worker.workCount > 0)
{
NzFunctor* task;
NzFunctor* task = nullptr;
if (TryEnterCriticalSection(&worker.queueMutex))
{
if (!worker.queue.empty())
@@ -158,8 +159,6 @@ NzFunctor* NzTaskSchedulerImpl::StealTask(unsigned int workerID)
worker.queue.pop();
worker.workCount = worker.queue.size();
}
else
task = nullptr;
LeaveCriticalSection(&worker.queueMutex);
}