forked from RPCS3/rpcs3
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Improved GLGSRender.
- Loading branch information
Showing
133 changed files
with
13,620 additions
and
3,894 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,97 @@ | ||
#include "stdafx.h" | ||
#include "Thread.h" | ||
|
||
ThreadBase* GetCurrentNamedThread() | ||
{ | ||
ThreadExec* thr = (ThreadExec*)::wxThread::This(); | ||
return thr ? thr->m_parent : nullptr; | ||
} | ||
|
||
ThreadBase::ThreadBase(bool detached, const wxString& name) | ||
: m_detached(detached) | ||
, m_name(name) | ||
, m_executor(nullptr) | ||
{ | ||
} | ||
|
||
void ThreadBase::Start() | ||
{ | ||
if(m_executor) return; | ||
|
||
m_executor = new ThreadExec(m_detached, this); | ||
} | ||
|
||
void ThreadBase::Resume() | ||
{ | ||
if(m_executor) | ||
{ | ||
m_executor->Resume(); | ||
} | ||
} | ||
|
||
void ThreadBase::Pause() | ||
{ | ||
if(m_executor) | ||
{ | ||
m_executor->Pause(); | ||
} | ||
} | ||
|
||
void ThreadBase::Stop(bool wait) | ||
{ | ||
if(!m_executor) return; | ||
ThreadExec* exec = m_executor; | ||
m_executor = nullptr; | ||
exec->Stop(wait); | ||
|
||
if(!m_detached) | ||
{ | ||
if(wait) | ||
{ | ||
exec->Wait(); | ||
} | ||
|
||
exec->Stop(false); | ||
delete exec; | ||
} | ||
else | ||
{ | ||
exec->Stop(wait); | ||
} | ||
} | ||
|
||
bool ThreadBase::IsAlive() | ||
bool ThreadBase::Wait() const | ||
{ | ||
return m_executor != nullptr && m_executor->Wait() != (wxThread::ExitCode)-1; | ||
} | ||
|
||
bool ThreadBase::IsRunning() const | ||
{ | ||
return m_executor != nullptr && m_executor->IsRunning(); | ||
} | ||
|
||
bool ThreadBase::IsPaused() const | ||
{ | ||
return m_executor != nullptr && m_executor->IsPaused(); | ||
} | ||
|
||
bool ThreadBase::IsAlive() const | ||
{ | ||
return m_executor != nullptr; | ||
} | ||
|
||
bool ThreadBase::TestDestroy() | ||
bool ThreadBase::TestDestroy() const | ||
{ | ||
if(!m_executor) return true; | ||
if(!m_executor || !m_executor->m_parent) return true; | ||
|
||
return m_executor->TestDestroy(); | ||
} | ||
|
||
wxString ThreadBase::GetThreadName() const | ||
{ | ||
return m_name; | ||
} | ||
|
||
void ThreadBase::SetThreadName(const wxString& name) | ||
{ | ||
m_name = name; | ||
} |
Oops, something went wrong.