Commit 24e0d0f0 authored by schurade's avatar schurade
Browse files

[FIX] fixed the mutex error, now OW quits with a seg faul again :)

parent e37e9b45
...@@ -39,7 +39,7 @@ WLogger::WLogger( std::string fileName, LogLevel level ): ...@@ -39,7 +39,7 @@ WLogger::WLogger( std::string fileName, LogLevel level ):
m_STDERRLevel( LL_ERROR ), m_STDERRLevel( LL_ERROR ),
m_LogFileLevel( level ), m_LogFileLevel( level ),
m_LogFileName( fileName ), m_LogFileName( fileName ),
m_FinishRequested( false ) m_QueueMutex()
{ {
addLogMessage( "Initalizing Logger", "Logger", LL_DEBUG ); addLogMessage( "Initalizing Logger", "Logger", LL_DEBUG );
addLogMessage( "===============================================================================", "Logger", LL_INFO ); addLogMessage( "===============================================================================", "Logger", LL_INFO );
...@@ -87,7 +87,7 @@ void WLogger::setLogFileName( std::string fileName ) ...@@ -87,7 +87,7 @@ void WLogger::setLogFileName( std::string fileName )
void WLogger::addLogMessage( std::string message, std::string source, LogLevel level ) void WLogger::addLogMessage( std::string message, std::string source, LogLevel level )
{ {
if ( m_LogLevel > level ) if ( m_LogLevel > level || m_FinishRequested )
{ {
return; return;
} }
...@@ -98,9 +98,6 @@ void WLogger::addLogMessage( std::string message, std::string source, LogLevel l ...@@ -98,9 +98,6 @@ void WLogger::addLogMessage( std::string message, std::string source, LogLevel l
boost::mutex::scoped_lock l( m_QueueMutex ); boost::mutex::scoped_lock l( m_QueueMutex );
m_LogQueue.push( entry ); m_LogQueue.push( entry );
// TODO(schurade): this must be called from the kernel
// processQueue();
} }
......
...@@ -138,11 +138,6 @@ private: ...@@ -138,11 +138,6 @@ private:
* *
*/ */
boost::mutex m_QueueMutex; boost::mutex m_QueueMutex;
/**
*
*/
bool m_FinishRequested;
}; };
#endif // WLOGGER_H #endif // WLOGGER_H
...@@ -63,6 +63,11 @@ WKernel::~WKernel() ...@@ -63,6 +63,11 @@ WKernel::~WKernel()
{ {
// cleanup // cleanup
m_Logger->addLogMessage( "Shutting down Kernel", "Kernel", LL_DEBUG ); m_Logger->addLogMessage( "Shutting down Kernel", "Kernel", LL_DEBUG );
// finish running thread
m_Logger->wait( true );
// write remaining log messages
m_Logger->processQueue();
} }
WKernel::WKernel( const WKernel& other ) WKernel::WKernel( const WKernel& other )
...@@ -163,6 +168,7 @@ void WKernel::init() ...@@ -163,6 +168,7 @@ void WKernel::init()
// initalize Logger // initalize Logger
m_Logger = boost::shared_ptr<WLogger>( new WLogger() ); m_Logger = boost::shared_ptr<WLogger>( new WLogger() );
m_Logger->run();
// initialize graphics engine // initialize graphics engine
// this also includes initialization of WGEScene and OpenSceneGraph // this also includes initialization of WGEScene and OpenSceneGraph
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment