diff --git a/stepmania/src/arch/InputHandler/InputHandler_Carbon.cpp b/stepmania/src/arch/InputHandler/InputHandler_Carbon.cpp index 9f71f4ce7a..0a9a5ea9fa 100644 --- a/stepmania/src/arch/InputHandler/InputHandler_Carbon.cpp +++ b/stepmania/src/arch/InputHandler/InputHandler_Carbon.cpp @@ -47,8 +47,11 @@ int InputHandler_Carbon::Run( void *data ) CFRetain( This->m_LoopRef ); This->StartDevices(); - SetThreadPrecedence( 1.0f ); - + { + const RString sError = SetThreadPrecedence( 1.0f ); + if( !sError.empty() ) + LOG->Warn( "Could not set precedence of the input thread: %s", sError.c_str() ); + } // Add an observer for the start of the run loop { /* The function copies the information out of the structure, so the memory pointed diff --git a/stepmania/src/arch/Sound/RageSoundDriver_AU.cpp b/stepmania/src/arch/Sound/RageSoundDriver_AU.cpp index c3e14469ba..cb71d11657 100644 --- a/stepmania/src/arch/Sound/RageSoundDriver_AU.cpp +++ b/stepmania/src/arch/Sound/RageSoundDriver_AU.cpp @@ -194,7 +194,9 @@ int64_t RageSoundDriver_AU::GetPosition() const void RageSoundDriver_AU::SetupDecodingThread() { /* Increase the scheduling precedence of the decoder thread. */ - SetThreadPrecedence( 0.75f ); + const RString sError = SetThreadPrecedence( 0.75f ); + if( !sError.empty() ) + LOG->Warn( "Could not set precedence of the decoding thread: %s", sError.c_str() ); } float RageSoundDriver_AU::GetPlayLatency() const diff --git a/stepmania/src/archutils/Darwin/DarwinThreadHelpers.cpp b/stepmania/src/archutils/Darwin/DarwinThreadHelpers.cpp index e27e51db71..44dda87a5d 100644 --- a/stepmania/src/archutils/Darwin/DarwinThreadHelpers.cpp +++ b/stepmania/src/archutils/Darwin/DarwinThreadHelpers.cpp @@ -3,8 +3,6 @@ #include #include #include "Backtrace.h" -#include "RageLog.h" -#include "RageUtil.h" bool SuspendThread( uint64_t threadHandle ) { @@ -53,18 +51,17 @@ bool GetThreadBacktraceContext( uint64_t iID, BacktraceContext *ctx ) #endif } -void SetThreadPrecedence( float prec ) +RString SetThreadPrecedence( float prec ) { // Real values are between 0 and 63. - if( CLAMP(prec, 0.0f, 1.0f) ) - LOG->Warn( "Thread precedence clamped to %f.", prec ); + DEBUG_ASSERT( 0.0f <= prec && prec <= 1.0f ); thread_precedence_policy po = { integer_t( lrintf(prec * 63) ) }; kern_return_t ret = thread_policy_set( mach_thread_self(), THREAD_PRECEDENCE_POLICY, (thread_policy_t)&po, THREAD_PRECEDENCE_POLICY_COUNT ); if( ret != KERN_SUCCESS ) - LOG->Warn( "Couldn't set the precedence for the input thread: %s", - mach_error_string(ret) ); + return mach_error_string( ret ); + return RString(); } /* diff --git a/stepmania/src/archutils/Darwin/DarwinThreadHelpers.h b/stepmania/src/archutils/Darwin/DarwinThreadHelpers.h index 4adc999614..4f3263090b 100644 --- a/stepmania/src/archutils/Darwin/DarwinThreadHelpers.h +++ b/stepmania/src/archutils/Darwin/DarwinThreadHelpers.h @@ -5,7 +5,7 @@ bool SuspendThread( uint64_t threadHandle ); bool ResumeThread( uint64_t threadHandle ); uint64_t GetCurrentThreadId(); // Valid values are from 0.0f to 1.0f. 0.5f is default. -void SetThreadPrecedence( float prec ); +RString SetThreadPrecedence( float prec ); #endif