diff --git a/src/gallantsignalwrapper.h b/src/gallantsignalwrapper.h deleted file mode 100644 index 08c710188..000000000 --- a/src/gallantsignalwrapper.h +++ /dev/null @@ -1,32 +0,0 @@ -#pragma once - -#include -#include -#include "Signals/Signal.h" - -namespace Ripes { -/** - * class CrossThreadSignalWrapper - * This class acts as a wrapper for Gallant signals. @p fun will be executed within the event loop context of @p obj, - * upon signal @p sig being triggered. This serves the following purposes: - * - Gallant signals only accepts raw pointers as callback functions; we'd like to be able to pass a lambda function. - * - Gallant signals are not thread safe. The wrapper will ensure that signals go through the signal/slot system of Qt, - * which checks for, and handles, cross-thread signals. - */ -struct GallantSignalWrapperBase { - virtual ~GallantSignalWrapperBase(){}; -}; - -template -class GallantSignalWrapper : public GallantSignalWrapperBase { -public: - GallantSignalWrapper(T* obj, F&& fun, D& sig, Qt::ConnectionType type = Qt::AutoConnection) { - wrapper = [=] { QMetaObject::invokeMethod(obj, fun, type); }; - sig.Connect(this, &GallantSignalWrapper::ftunnel); - } - -private: - void ftunnel() { wrapper(); } - std::function wrapper; -}; -} // namespace Ripes diff --git a/src/processorhandler.cpp b/src/processorhandler.cpp index 08d735378..d4d55f83d 100644 --- a/src/processorhandler.cpp +++ b/src/processorhandler.cpp @@ -271,7 +271,7 @@ void ProcessorHandler::_selectProcessor(const ProcessorID& id, const QStringList // Connect wrappers for making processor signal emissions thread safe. m_signalWrappers.clear(); - m_signalWrappers.push_back(std::unique_ptr(new GallantSignalWrapper( + m_signalWrappers.push_back(std::unique_ptr(new vsrtl::GallantSignalWrapper( this, [=] { if (!_isRunning()) { @@ -285,7 +285,7 @@ void ProcessorHandler::_selectProcessor(const ProcessorID& id, const QStringList // cross-thread and out of order. m_currentProcessor->processorWasClocked.Connect(this, &ProcessorHandler::processorClocked); - m_signalWrappers.push_back(std::unique_ptr(new GallantSignalWrapper( + m_signalWrappers.push_back(std::unique_ptr(new vsrtl::GallantSignalWrapper( this, [=] { emit processorReset(); @@ -293,7 +293,7 @@ void ProcessorHandler::_selectProcessor(const ProcessorID& id, const QStringList }, m_currentProcessor->processorWasReset))); - m_signalWrappers.push_back(std::unique_ptr(new GallantSignalWrapper( + m_signalWrappers.push_back(std::unique_ptr(new vsrtl::GallantSignalWrapper( this, [=] { emit processorReversed(); diff --git a/src/processorhandler.h b/src/processorhandler.h index 4ca48152b..7258728d0 100644 --- a/src/processorhandler.h +++ b/src/processorhandler.h @@ -260,6 +260,6 @@ private slots: * Semaphore handling locking simulator thread execution whilst trapping to the execution environment. */ QSemaphore m_sem; - std::vector> m_signalWrappers; + std::vector> m_signalWrappers; }; } // namespace Ripes