mirror of https://github.com/PCSX2/pcsx2.git
I speal gewd. (Aquire -> Acquire)
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2103 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
bc2aa38aa1
commit
e92e3fb4bb
|
@ -41,7 +41,7 @@ namespace Exception
|
|||
// --------------------------------------------------------------------------------------
|
||||
// ThreadTimedOut Exception
|
||||
// --------------------------------------------------------------------------------------
|
||||
// This exception is thrown by Semaphore and Mutex Wait/Aquire functions if a blocking wait is
|
||||
// This exception is thrown by Semaphore and Mutex Wait/Acquire functions if a blocking wait is
|
||||
// needed due to gui Yield recursion, and the timeout period for deadlocking (usually 3 seconds)
|
||||
// is reached before the lock becomes available. This exception cannot occur in the following
|
||||
// conditions:
|
||||
|
@ -130,8 +130,8 @@ namespace Threading
|
|||
// trylock(), but without any of the extra overhead needed to set up a structure capable
|
||||
// of blocking waits. It basically optimizes to a single InterlockedExchange.
|
||||
//
|
||||
// Simple use: if TryAquire() returns false, the Bool is already interlocked by another thread.
|
||||
// If TryAquire() returns true, you've locked the object and are *responsible* for unlocking
|
||||
// Simple use: if TryAcquire() returns false, the Bool is already interlocked by another thread.
|
||||
// If TryAcquire() returns true, you've locked the object and are *responsible* for unlocking
|
||||
// it later.
|
||||
//
|
||||
class NonblockingMutex
|
||||
|
@ -143,7 +143,7 @@ namespace Threading
|
|||
NonblockingMutex() : val( false ) {}
|
||||
virtual ~NonblockingMutex() throw() {}
|
||||
|
||||
bool TryAquire() throw()
|
||||
bool TryAcquire() throw()
|
||||
{
|
||||
return !AtomicExchange( val, true );
|
||||
}
|
||||
|
@ -194,13 +194,13 @@ namespace Threading
|
|||
bool RecreateIfLocked();
|
||||
void Detach();
|
||||
|
||||
void Aquire();
|
||||
bool Aquire( const wxTimeSpan& timeout );
|
||||
bool TryAquire();
|
||||
void Acquire();
|
||||
bool Acquire( const wxTimeSpan& timeout );
|
||||
bool TryAcquire();
|
||||
void Release();
|
||||
|
||||
void FullBlockingAquire();
|
||||
bool FullBlockingAquire( const wxTimeSpan& timeout );
|
||||
void FullBlockingAcquire();
|
||||
bool FullBlockingAcquire( const wxTimeSpan& timeout );
|
||||
|
||||
void Wait();
|
||||
bool Wait( const wxTimeSpan& timeout );
|
||||
|
@ -383,7 +383,7 @@ namespace Threading
|
|||
m_lock( locker )
|
||||
, m_IsLocked( true )
|
||||
{
|
||||
m_lock.Aquire();
|
||||
m_lock.Acquire();
|
||||
}
|
||||
|
||||
// Provides manual unlocking of a scoped lock prior to object destruction.
|
||||
|
@ -395,10 +395,10 @@ namespace Threading
|
|||
}
|
||||
|
||||
// provides manual locking of a scoped lock, to re-lock after a manual unlocking.
|
||||
void Aquire()
|
||||
void Acquire()
|
||||
{
|
||||
if( m_IsLocked ) return;
|
||||
m_lock.Aquire();
|
||||
m_lock.Acquire();
|
||||
m_IsLocked = true;
|
||||
}
|
||||
|
||||
|
@ -408,7 +408,7 @@ namespace Threading
|
|||
// Special constructor used by ScopedTryLock
|
||||
ScopedLock( Mutex& locker, bool isTryLock ) :
|
||||
m_lock( locker )
|
||||
, m_IsLocked( isTryLock ? m_lock.TryAquire() : false )
|
||||
, m_IsLocked( isTryLock ? m_lock.TryAcquire() : false )
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -438,7 +438,7 @@ namespace Threading
|
|||
public:
|
||||
ScopedNonblockingLock( NonblockingMutex& locker ) :
|
||||
m_lock( locker )
|
||||
, m_IsLocked( m_lock.TryAquire() )
|
||||
, m_IsLocked( m_lock.TryAcquire() )
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -112,12 +112,12 @@ bool Threading::Mutex::RecreateIfLocked()
|
|||
// if used from the main GUI thread, since it typically results in an unresponsive program.
|
||||
// Call this method directly only if you know the code in question will be run from threads
|
||||
// other than the main thread.
|
||||
void Threading::Mutex::FullBlockingAquire()
|
||||
void Threading::Mutex::FullBlockingAcquire()
|
||||
{
|
||||
pthread_mutex_lock( &m_mutex );
|
||||
}
|
||||
|
||||
bool Threading::Mutex::FullBlockingAquire( const wxTimeSpan& timeout )
|
||||
bool Threading::Mutex::FullBlockingAcquire( const wxTimeSpan& timeout )
|
||||
{
|
||||
wxDateTime megafail( wxDateTime::UNow() + timeout );
|
||||
const timespec fail = { megafail.GetTicks(), megafail.GetMillisecond() * 1000000 };
|
||||
|
@ -129,64 +129,64 @@ void Threading::Mutex::Release()
|
|||
pthread_mutex_unlock( &m_mutex );
|
||||
}
|
||||
|
||||
bool Threading::Mutex::TryAquire()
|
||||
bool Threading::Mutex::TryAcquire()
|
||||
{
|
||||
return EBUSY != pthread_mutex_trylock( &m_mutex );
|
||||
}
|
||||
|
||||
// This is a wxApp-safe rendition of FullBlockingAquire, which makes sure to execute pending app events
|
||||
// This is a wxApp-safe rendition of FullBlockingAcquire, which makes sure to execute pending app events
|
||||
// and messages *if* the lock is performed from the main GUI thread.
|
||||
//
|
||||
// Exceptions:
|
||||
// ThreadTimedOut - See description of ThreadTimedOut for details
|
||||
//
|
||||
void Threading::Mutex::Aquire()
|
||||
void Threading::Mutex::Acquire()
|
||||
{
|
||||
#if wxUSE_GUI
|
||||
if( !wxThread::IsMain() || (wxTheApp == NULL) )
|
||||
{
|
||||
FullBlockingAquire();
|
||||
FullBlockingAcquire();
|
||||
}
|
||||
else if( _WaitGui_RecursionGuard( "Mutex::Aquire" ) )
|
||||
else if( _WaitGui_RecursionGuard( "Mutex::Acquire" ) )
|
||||
{
|
||||
if( !FullBlockingAquire(def_deadlock_timeout) )
|
||||
if( !FullBlockingAcquire(def_deadlock_timeout) )
|
||||
throw Exception::ThreadTimedOut();
|
||||
}
|
||||
else
|
||||
{
|
||||
while( !FullBlockingAquire(def_yieldgui_interval) )
|
||||
while( !FullBlockingAcquire(def_yieldgui_interval) )
|
||||
wxTheApp->Yield( true );
|
||||
}
|
||||
#else
|
||||
FullBlockingAquire();
|
||||
FullBlockingAcquire();
|
||||
#endif
|
||||
}
|
||||
|
||||
// Exceptions:
|
||||
// ThreadTimedOut - See description of ThreadTimedOut for details
|
||||
//
|
||||
bool Threading::Mutex::Aquire( const wxTimeSpan& timeout )
|
||||
bool Threading::Mutex::Acquire( const wxTimeSpan& timeout )
|
||||
{
|
||||
#if wxUSE_GUI
|
||||
if( !wxThread::IsMain() || (wxTheApp == NULL) )
|
||||
{
|
||||
return FullBlockingAquire(timeout);
|
||||
return FullBlockingAcquire(timeout);
|
||||
}
|
||||
else if( _WaitGui_RecursionGuard( "Mutex::Aquire(timeout)" ) )
|
||||
else if( _WaitGui_RecursionGuard( "Mutex::Acquire(timeout)" ) )
|
||||
{
|
||||
if( timeout > def_deadlock_timeout )
|
||||
{
|
||||
if( FullBlockingAquire(def_deadlock_timeout) ) return true;
|
||||
if( FullBlockingAcquire(def_deadlock_timeout) ) return true;
|
||||
throw Exception::ThreadTimedOut();
|
||||
}
|
||||
return FullBlockingAquire( timeout );
|
||||
return FullBlockingAcquire( timeout );
|
||||
}
|
||||
else
|
||||
{
|
||||
wxTimeSpan countdown( (timeout) );
|
||||
|
||||
do {
|
||||
if( FullBlockingAquire( def_yieldgui_interval ) ) break;
|
||||
if( FullBlockingAcquire( def_yieldgui_interval ) ) break;
|
||||
wxTheApp->Yield(true);
|
||||
countdown -= def_yieldgui_interval;
|
||||
} while( countdown.GetMilliseconds() > 0 );
|
||||
|
@ -198,7 +198,7 @@ bool Threading::Mutex::Aquire( const wxTimeSpan& timeout )
|
|||
throw Exception::ThreadTimedOut();
|
||||
|
||||
#else
|
||||
return FullBlockingAquire();
|
||||
return FullBlockingAcquire();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -207,19 +207,19 @@ bool Threading::Mutex::Aquire( const wxTimeSpan& timeout )
|
|||
// specific task, and to block until the task is finished (PersistentThread uses it to
|
||||
// determine if the thread is running or completed, for example).
|
||||
//
|
||||
// Implemented internally as a simple Aquire/Release pair.
|
||||
// Implemented internally as a simple Acquire/Release pair.
|
||||
//
|
||||
// Exceptions:
|
||||
// ThreadTimedOut - See description of ThreadTimedOut for details
|
||||
//
|
||||
void Threading::Mutex::Wait()
|
||||
{
|
||||
Aquire();
|
||||
Acquire();
|
||||
Release();
|
||||
}
|
||||
|
||||
// Performs a wait on a locked mutex, or returns instantly if the mutex is unlocked.
|
||||
// (Implemented internally as a simple Aquire/Release pair.)
|
||||
// (Implemented internally as a simple Acquire/Release pair.)
|
||||
//
|
||||
// Returns:
|
||||
// true if the mutex was freed and is in an unlocked state; or false if the wait timed out
|
||||
|
@ -230,7 +230,7 @@ void Threading::Mutex::Wait()
|
|||
//
|
||||
bool Threading::Mutex::Wait( const wxTimeSpan& timeout )
|
||||
{
|
||||
if( Aquire(timeout) )
|
||||
if( Acquire(timeout) )
|
||||
{
|
||||
Release();
|
||||
return true;
|
||||
|
|
|
@ -390,7 +390,7 @@ void Threading::PersistentThread::OnStartInThread()
|
|||
|
||||
void Threading::PersistentThread::_internal_execute()
|
||||
{
|
||||
m_lock_InThread.Aquire();
|
||||
m_lock_InThread.Acquire();
|
||||
OnStartInThread();
|
||||
|
||||
_DoSetThreadName( m_name );
|
||||
|
@ -510,7 +510,7 @@ void Threading::BaseTaskThread::ExecuteTaskInThread()
|
|||
m_sem_event.WaitRaw();
|
||||
|
||||
Task();
|
||||
m_lock_TaskComplete.Aquire();
|
||||
m_lock_TaskComplete.Acquire();
|
||||
m_TaskPending = false;
|
||||
m_post_TaskComplete.Post();
|
||||
m_lock_TaskComplete.Release();
|
||||
|
|
|
@ -520,7 +520,7 @@ static void cdvdDetectDisk()
|
|||
|
||||
void cdvdNewDiskCB()
|
||||
{
|
||||
if( !Mutex_NewDiskCB.TryAquire() ) return;
|
||||
if( !Mutex_NewDiskCB.TryAcquire() ) return;
|
||||
DoCDVDresetDiskTypeCache();
|
||||
|
||||
try { cdvdDetectDisk(); }
|
||||
|
|
|
@ -561,7 +561,7 @@ static u32 ringtx_inf_s[32];
|
|||
// size - size of the packet data, in smd128's
|
||||
int mtgsThreadObject::PrepDataPacket( GIF_PATH pathidx, const u8* srcdata, u32 size )
|
||||
{
|
||||
//m_PacketLocker.Aquire();
|
||||
//m_PacketLocker.Acquire();
|
||||
|
||||
#ifdef PCSX2_GSRING_TX_STATS
|
||||
ringtx_s += size;
|
||||
|
@ -674,7 +674,7 @@ int mtgsThreadObject::PrepDataPacket( GIF_PATH pathidx, const u8* srcdata, u32 s
|
|||
SpinWait();
|
||||
}
|
||||
|
||||
m_lock_RingRestart.Aquire();
|
||||
m_lock_RingRestart.Acquire();
|
||||
SendSimplePacket( GS_RINGTYPE_RESTART, 0, 0, 0 );
|
||||
m_WritePos = writepos = 0;
|
||||
m_lock_RingRestart.Release();
|
||||
|
|
|
@ -72,7 +72,7 @@ protected:
|
|||
|
||||
void OnStart()
|
||||
{
|
||||
if( !state_buffer_lock.TryAquire() )
|
||||
if( !state_buffer_lock.TryAcquire() )
|
||||
throw Exception::CancelEvent( m_name + L"request ignored: state copy buffer is already locked!" );
|
||||
|
||||
_parent::OnStart();
|
||||
|
@ -429,7 +429,7 @@ void StateCopy_ThawFromMem()
|
|||
|
||||
void State_ThawFromMem_Blocking()
|
||||
{
|
||||
if( !state_buffer_lock.TryAquire() )
|
||||
if( !state_buffer_lock.TryAcquire() )
|
||||
|
||||
memLoadingState( state_buffer ).FreezeAll();
|
||||
state_buffer_lock.Release();
|
||||
|
|
|
@ -245,7 +245,7 @@ void SysThreadBase::Resume()
|
|||
|
||||
void SysThreadBase::OnStartInThread()
|
||||
{
|
||||
m_RunningLock.Aquire();
|
||||
m_RunningLock.Acquire();
|
||||
_parent::OnStartInThread();
|
||||
m_ResumeEvent.Post();
|
||||
}
|
||||
|
@ -292,7 +292,7 @@ void SysThreadBase::StateCheckInThread()
|
|||
while( m_ExecMode == ExecMode_Paused )
|
||||
m_ResumeEvent.WaitRaw();
|
||||
|
||||
m_RunningLock.Aquire();
|
||||
m_RunningLock.Acquire();
|
||||
OnResumeInThread( false );
|
||||
break;
|
||||
|
||||
|
@ -309,7 +309,7 @@ void SysThreadBase::StateCheckInThread()
|
|||
while( m_ExecMode == ExecMode_Closed )
|
||||
m_ResumeEvent.WaitRaw();
|
||||
|
||||
m_RunningLock.Aquire();
|
||||
m_RunningLock.Acquire();
|
||||
OnResumeInThread( true );
|
||||
break;
|
||||
|
||||
|
|
|
@ -134,7 +134,7 @@ public:
|
|||
virtual void Resume();
|
||||
virtual bool Pause();
|
||||
|
||||
virtual bool AquireResumeLock() { return m_ResumeProtection.TryAquire(); }
|
||||
virtual bool AcquireResumeLock() { return m_ResumeProtection.TryAcquire(); }
|
||||
virtual void ReleaseResumeLock() { m_ResumeProtection.Release(); }
|
||||
|
||||
protected:
|
||||
|
|
|
@ -447,7 +447,7 @@ static wxString _sysexec_elf_override;
|
|||
|
||||
static void _sendmsg_SysExecute()
|
||||
{
|
||||
if( !CoreThread.AquireResumeLock() )
|
||||
if( !CoreThread.AcquireResumeLock() )
|
||||
{
|
||||
DbgCon.WriteLn( "(SysExecute) another resume lock or message is already pending; no message posted." );
|
||||
return;
|
||||
|
|
|
@ -370,7 +370,7 @@ void ConsoleLogFrame::Write( ConsoleColors color, const wxString& text )
|
|||
{
|
||||
// Necessary since the main thread could grab the lock and process before
|
||||
// the above function actually returns (gotta love threading!)
|
||||
lock.Aquire();
|
||||
lock.Acquire();
|
||||
if( m_WaitingThreadsForFlush != 0 ) --m_WaitingThreadsForFlush;
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue