Disable the real time critical sections, it's causing audio problems on single processor machines.
This commit is contained in:
@@ -19,8 +19,12 @@
|
|||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
|
|
||||||
|
#define REAL_TIME_CRITICAL_SECTION 0
|
||||||
|
|
||||||
|
#if REAL_TIME_CRITICAL_SECTION
|
||||||
static thread_time_constraint_policy g_oldttcpolicy;
|
static thread_time_constraint_policy g_oldttcpolicy;
|
||||||
static float g_fStartedTimeCritAt;
|
static float g_fStartedTimeCritAt;
|
||||||
|
#endif
|
||||||
|
|
||||||
static bool IsFatalSignal( int signal )
|
static bool IsFatalSignal( int signal )
|
||||||
{
|
{
|
||||||
@@ -227,6 +231,7 @@ RString ArchHooks::GetPreferredLanguage()
|
|||||||
|
|
||||||
void ArchHooks_darwin::EnterTimeCriticalSection()
|
void ArchHooks_darwin::EnterTimeCriticalSection()
|
||||||
{
|
{
|
||||||
|
#if REAL_TIME_CRITICAL_SECTION
|
||||||
TimeCritMutex->Lock();
|
TimeCritMutex->Lock();
|
||||||
|
|
||||||
mach_msg_type_number_t cnt = THREAD_TIME_CONSTRAINT_POLICY_COUNT;
|
mach_msg_type_number_t cnt = THREAD_TIME_CONSTRAINT_POLICY_COUNT;
|
||||||
@@ -261,10 +266,12 @@ void ArchHooks_darwin::EnterTimeCriticalSection()
|
|||||||
LOG->Warn( "thread_policy_set(THREAD_TIME_CONSTRAINT_POLICY): %s", mach_error_string(ret) );
|
LOG->Warn( "thread_policy_set(THREAD_TIME_CONSTRAINT_POLICY): %s", mach_error_string(ret) );
|
||||||
|
|
||||||
g_fStartedTimeCritAt = RageTimer::GetTimeSinceStart();
|
g_fStartedTimeCritAt = RageTimer::GetTimeSinceStart();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArchHooks_darwin::ExitTimeCriticalSection()
|
void ArchHooks_darwin::ExitTimeCriticalSection()
|
||||||
{
|
{
|
||||||
|
#if REAL_TIME_CRITICAL_SECTION
|
||||||
kern_return_t ret;
|
kern_return_t ret;
|
||||||
|
|
||||||
ret = thread_policy_set( mach_thread_self(), THREAD_TIME_CONSTRAINT_POLICY,
|
ret = thread_policy_set( mach_thread_self(), THREAD_TIME_CONSTRAINT_POLICY,
|
||||||
@@ -277,6 +284,7 @@ void ArchHooks_darwin::ExitTimeCriticalSection()
|
|||||||
float fTimeCritLen = RageTimer::GetTimeSinceStart() - g_fStartedTimeCritAt;
|
float fTimeCritLen = RageTimer::GetTimeSinceStart() - g_fStartedTimeCritAt;
|
||||||
if( fTimeCritLen > 0.003f )
|
if( fTimeCritLen > 0.003f )
|
||||||
LOG->Warn( "Time-critical section lasted for %f", fTimeCritLen );
|
LOG->Warn( "Time-critical section lasted for %f", fTimeCritLen );
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t ArchHooks::GetMicrosecondsSinceStart( bool bAccurate )
|
int64_t ArchHooks::GetMicrosecondsSinceStart( bool bAccurate )
|
||||||
|
|||||||
Reference in New Issue
Block a user