1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-11-09 12:22:34 +01:00

Change threading in naieve attempt at fixing crash

This commit is contained in:
Daniel Evans 2014-08-05 13:41:44 +01:00
parent 6c78b0c3c5
commit eea4118eed
3 changed files with 16 additions and 11 deletions

View File

@ -11,10 +11,12 @@ SET(BUILD_SCRIPT_TOOL TRUE CACHE BOOL "Build script decompiler tool")
SET(BUILD_OLD_TOOLS FALSE CACHE BOOL "Build old datadump and analyzer tools")
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -pthread")
IF(CMAKE_BUILD_TYPE MATCHES Debug)
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -std=c++11 -Wall -Wextra" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wextra" )
ELSE()
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -std=c++11 -Wall" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3" )
ENDIF()
# Make GLM use radians

View File

@ -121,8 +121,8 @@ public:
if( mFdm )
{
munmap( mFdm, mStat.st_size );
mad_decoder_finish(&mDecoder);
}
mad_decoder_finish(&mDecoder);
}
bool open(const std::string& loc)

View File

@ -12,18 +12,21 @@ void LoadWorker::start()
void WorkContext::workNext()
{
WorkJob* j = nullptr;
{
std::lock_guard<std::mutex> guard( _inMutex );
if( _workQueue.empty() ) return;
j = _workQueue.front(); _workQueue.pop();
_inMutex.lock();
if( ! _workQueue.empty() ) {
j = _workQueue.front();
_workQueue.pop();
}
_inMutex.unlock();
if( j == nullptr ) return;
j->work();
{
std::lock_guard<std::mutex> guard( _outMutex );
_completeQueue.push( j );
}
_outMutex.lock();
_completeQueue.push(j);
_outMutex.unlock();
}
void WorkContext::update()