mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 16:44:36 +00:00
Fix for no sound output under Linux
This commit is contained in:
parent
eb0351139e
commit
f3199b04e4
2 changed files with 9 additions and 4 deletions
|
|
@ -42,7 +42,8 @@ inline void dFetchAndAdd( volatile U32& ref, U32 val )
|
||||||
#if defined(TORQUE_OS_PS3)
|
#if defined(TORQUE_OS_PS3)
|
||||||
cellAtomicAdd32( (std::uint32_t *)&ref, val );
|
cellAtomicAdd32( (std::uint32_t *)&ref, val );
|
||||||
#elif !defined(TORQUE_OS_MAC)
|
#elif !defined(TORQUE_OS_MAC)
|
||||||
__sync_fetch_and_add( ( volatile long* ) &ref, val );
|
//__sync_fetch_and_add( ( volatile long* ) &ref, val );
|
||||||
|
__sync_fetch_and_add(&ref, val );
|
||||||
#else
|
#else
|
||||||
OSAtomicAdd32( val, (int32_t* ) &ref);
|
OSAtomicAdd32( val, (int32_t* ) &ref);
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -53,7 +54,8 @@ inline void dFetchAndAdd( volatile S32& ref, S32 val )
|
||||||
#if defined(TORQUE_OS_PS3)
|
#if defined(TORQUE_OS_PS3)
|
||||||
cellAtomicAdd32( (std::uint32_t *)&ref, val );
|
cellAtomicAdd32( (std::uint32_t *)&ref, val );
|
||||||
#elif !defined(TORQUE_OS_MAC)
|
#elif !defined(TORQUE_OS_MAC)
|
||||||
__sync_fetch_and_add( ( volatile long* ) &ref, val );
|
//__sync_fetch_and_add( ( volatile long* ) &ref, val );
|
||||||
|
__sync_fetch_and_add( &ref, val );
|
||||||
#else
|
#else
|
||||||
OSAtomicAdd32( val, (int32_t* ) &ref);
|
OSAtomicAdd32( val, (int32_t* ) &ref);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -418,8 +418,11 @@ void ThreadPool::queueWorkItem( WorkItem* item )
|
||||||
// thread's run function. This may lead us to release
|
// thread's run function. This may lead us to release
|
||||||
// the semaphore more often than necessary, but it avoids
|
// the semaphore more often than necessary, but it avoids
|
||||||
// a race condition.
|
// a race condition.
|
||||||
|
|
||||||
if( !dCompareAndSwap( mNumThreadsReady, mNumThreads, mNumThreads ) )
|
//Wasn't there still a race condition? Why not rely entirely on the semaphore?
|
||||||
|
//For example, mNumThreadsReady initializes equalto mNumThreads, which could cause
|
||||||
|
//initial work items to hang.
|
||||||
|
//if( !dCompareAndSwap( mNumThreadsReady, mNumThreads, mNumThreads ) )
|
||||||
mSemaphore.release();
|
mSemaphore.release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue