Skip to content

Commit

Permalink
Base: rename ISignalThreadHelper::execInThread() to runOnThread()
Browse files Browse the repository at this point in the history
  • Loading branch information
HuguesDelorme committed Jun 21, 2024
1 parent 2724762 commit a392fbd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/base/signal.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ class ISignalThreadHelper {
// Get implementation-specific context object for the current thread
virtual std::any getCurrentThreadContext() = 0;

// Executes function 'fn' in target thread referred by 'context'
// Posts the function 'fn' to target thread referred by 'context'
// If current thread is different from target thread then implementation has to ensure 'fn' is
// executed in target thread(eg by enqueuing 'fn' in some event loop)
// executed on target thread(eg by enqueuing 'fn' in some event loop)
// 'context' is the implementation-specific thread context object identified in a previous call
// to getCurrentThreadContext()
virtual void execInThread(const std::any& context, const std::function<void()>& fn) = 0;
virtual void runOnThread(const std::any& context, const std::function<void()>& fn) = 0;
};

// Getter/setter functions of the global ISignalThreadHelper object used by Signal::connectSlot()
Expand Down Expand Up @@ -89,7 +89,7 @@ class Signal : public KDBindings::Signal<Args...> {
if (emitThreadId == connectThreadId)
fnSlot(args...);
else
getGlobalSignalThreadHelper()->execInThread(threadContext, [=]{ fnSlot(args...); });
getGlobalSignalThreadHelper()->runOnThread(threadContext, [=]{ fnSlot(args...); });
};
return this->connect(fnWrap);
}
Expand Down
2 changes: 1 addition & 1 deletion src/qtbackend/qt_signal_thread_helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ std::any QtSignalThreadHelper::getCurrentThreadContext()
return &obj;
}

void QtSignalThreadHelper::execInThread(const std::any& context, const std::function<void()>& fn)
void QtSignalThreadHelper::runOnThread(const std::any& context, const std::function<void()>& fn)
{
QTimer::singleShot(0, std::any_cast<QObject*>(context), fn);
}
Expand Down
2 changes: 1 addition & 1 deletion src/qtbackend/qt_signal_thread_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace Mayo {
class QtSignalThreadHelper : public ISignalThreadHelper {
public:
std::any getCurrentThreadContext() override;
void execInThread(const std::any& context, const std::function<void()>& fn) override;
void runOnThread(const std::any& context, const std::function<void()>& fn) override;
};

} // namespace Mayo

0 comments on commit a392fbd

Please sign in to comment.