Change set precedence api to return an error message.
This commit is contained in:
@@ -47,8 +47,11 @@ int InputHandler_Carbon::Run( void *data )
|
|||||||
CFRetain( This->m_LoopRef );
|
CFRetain( This->m_LoopRef );
|
||||||
|
|
||||||
This->StartDevices();
|
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
|
// Add an observer for the start of the run loop
|
||||||
{
|
{
|
||||||
/* The function copies the information out of the structure, so the memory pointed
|
/* The function copies the information out of the structure, so the memory pointed
|
||||||
|
|||||||
@@ -194,7 +194,9 @@ int64_t RageSoundDriver_AU::GetPosition() const
|
|||||||
void RageSoundDriver_AU::SetupDecodingThread()
|
void RageSoundDriver_AU::SetupDecodingThread()
|
||||||
{
|
{
|
||||||
/* Increase the scheduling precedence of the decoder thread. */
|
/* 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
|
float RageSoundDriver_AU::GetPlayLatency() const
|
||||||
|
|||||||
@@ -3,8 +3,6 @@
|
|||||||
#include <mach/mach_init.h>
|
#include <mach/mach_init.h>
|
||||||
#include <mach/mach_error.h>
|
#include <mach/mach_error.h>
|
||||||
#include "Backtrace.h"
|
#include "Backtrace.h"
|
||||||
#include "RageLog.h"
|
|
||||||
#include "RageUtil.h"
|
|
||||||
|
|
||||||
bool SuspendThread( uint64_t threadHandle )
|
bool SuspendThread( uint64_t threadHandle )
|
||||||
{
|
{
|
||||||
@@ -53,18 +51,17 @@ bool GetThreadBacktraceContext( uint64_t iID, BacktraceContext *ctx )
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetThreadPrecedence( float prec )
|
RString SetThreadPrecedence( float prec )
|
||||||
{
|
{
|
||||||
// Real values are between 0 and 63.
|
// Real values are between 0 and 63.
|
||||||
if( CLAMP(prec, 0.0f, 1.0f) )
|
DEBUG_ASSERT( 0.0f <= prec && prec <= 1.0f );
|
||||||
LOG->Warn( "Thread precedence clamped to %f.", prec );
|
|
||||||
thread_precedence_policy po = { integer_t( lrintf(prec * 63) ) };
|
thread_precedence_policy po = { integer_t( lrintf(prec * 63) ) };
|
||||||
kern_return_t ret = thread_policy_set( mach_thread_self(), THREAD_PRECEDENCE_POLICY,
|
kern_return_t ret = thread_policy_set( mach_thread_self(), THREAD_PRECEDENCE_POLICY,
|
||||||
(thread_policy_t)&po, THREAD_PRECEDENCE_POLICY_COUNT );
|
(thread_policy_t)&po, THREAD_PRECEDENCE_POLICY_COUNT );
|
||||||
|
|
||||||
if( ret != KERN_SUCCESS )
|
if( ret != KERN_SUCCESS )
|
||||||
LOG->Warn( "Couldn't set the precedence for the input thread: %s",
|
return mach_error_string( ret );
|
||||||
mach_error_string(ret) );
|
return RString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ bool SuspendThread( uint64_t threadHandle );
|
|||||||
bool ResumeThread( uint64_t threadHandle );
|
bool ResumeThread( uint64_t threadHandle );
|
||||||
uint64_t GetCurrentThreadId();
|
uint64_t GetCurrentThreadId();
|
||||||
// Valid values are from 0.0f to 1.0f. 0.5f is default.
|
// Valid values are from 0.0f to 1.0f. 0.5f is default.
|
||||||
void SetThreadPrecedence( float prec );
|
RString SetThreadPrecedence( float prec );
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user