Qt: Remove thread parameter for Interrupter that can be autodetected

This commit is contained in:
Vicki Pfau 2020-11-14 15:49:39 -08:00
parent 9a0561e9c2
commit 89937d62b0
5 changed files with 11 additions and 11 deletions

View File

@ -1008,26 +1008,26 @@ void CoreController::updateFastForward() {
m_threadContext.core->reloadConfigOption(m_threadContext.core, NULL, NULL);
}
CoreController::Interrupter::Interrupter(CoreController* parent, bool fromThread)
CoreController::Interrupter::Interrupter(CoreController* parent)
: m_parent(parent)
{
if (!m_parent->thread()->impl) {
return;
}
if (!fromThread) {
if (mCoreThreadGet() != m_parent->thread()) {
mCoreThreadInterrupt(m_parent->thread());
} else {
mCoreThreadInterruptFromThread(m_parent->thread());
}
}
CoreController::Interrupter::Interrupter(std::shared_ptr<CoreController> parent, bool fromThread)
CoreController::Interrupter::Interrupter(std::shared_ptr<CoreController> parent)
: m_parent(parent.get())
{
if (!m_parent->thread()->impl) {
return;
}
if (!fromThread) {
if (mCoreThreadGet() != m_parent->thread()) {
mCoreThreadInterrupt(m_parent->thread());
} else {
mCoreThreadInterruptFromThread(m_parent->thread());

View File

@ -53,8 +53,8 @@ public:
class Interrupter {
public:
Interrupter(CoreController*, bool fromThread = false);
Interrupter(std::shared_ptr<CoreController>, bool fromThread = false);
Interrupter(CoreController*);
Interrupter(std::shared_ptr<CoreController>);
Interrupter(const Interrupter&);
~Interrupter();

View File

@ -79,7 +79,7 @@ void DebuggerConsoleController::deinit(struct CLIDebuggerBackend* be) {
const char* DebuggerConsoleController::readLine(struct CLIDebuggerBackend* be, size_t* len) {
Backend* consoleBe = reinterpret_cast<Backend*>(be);
DebuggerConsoleController* self = consoleBe->self;
CoreController::Interrupter interrupter(self->m_gameController, true);
CoreController::Interrupter interrupter(self->m_gameController);
QMutexLocker lock(&self->m_mutex);
while (self->m_lines.isEmpty()) {
self->m_cond.wait(&self->m_mutex);
@ -103,7 +103,7 @@ void DebuggerConsoleController::lineAppend(struct CLIDebuggerBackend* be, const
const char* DebuggerConsoleController::historyLast(struct CLIDebuggerBackend* be, size_t* len) {
Backend* consoleBe = reinterpret_cast<Backend*>(be);
DebuggerConsoleController* self = consoleBe->self;
CoreController::Interrupter interrupter(self->m_gameController, true);
CoreController::Interrupter interrupter(self->m_gameController);
QMutexLocker lock(&self->m_mutex);
if (self->m_history.isEmpty()) {
return "i";
@ -115,7 +115,7 @@ const char* DebuggerConsoleController::historyLast(struct CLIDebuggerBackend* be
void DebuggerConsoleController::historyAppend(struct CLIDebuggerBackend* be, const char* line) {
Backend* consoleBe = reinterpret_cast<Backend*>(be);
DebuggerConsoleController* self = consoleBe->self;
CoreController::Interrupter interrupter(self->m_gameController, true);
CoreController::Interrupter interrupter(self->m_gameController);
QMutexLocker lock(&self->m_mutex);
self->m_history.append(QString::fromUtf8(line));
}

View File

@ -521,7 +521,7 @@ void FrameView::frameCallback(FrameView* viewer, std::shared_ptr<bool> lock) {
if (!*lock) {
return;
}
CoreController::Interrupter interrupter(viewer->m_controller, true);
CoreController::Interrupter interrupter(viewer->m_controller);
viewer->refreshVl();
viewer->m_controller->addFrameAction(std::bind(&FrameView::frameCallback, viewer, lock));
}

View File

@ -766,7 +766,7 @@ void Window::gameStarted() {
m_screenWidget->setCursor(Qt::BlankCursor);
}
CoreController::Interrupter interrupter(m_controller, true);
CoreController::Interrupter interrupter(m_controller);
mCore* core = m_controller->thread()->core;
m_actions.clearMenu("videoLayers");
m_actions.clearMenu("audioChannels");