Changeset 287 in pacpusframework


Ignore:
Timestamp:
Mar 26, 2014, 8:59:09 PM (11 years ago)
Author:
Marek Kurdej
Message:

MAJOR: InputOutputInterface has a separate thread for each input slot.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/Pacpus/kernel/InputOutputInterface.h

    r273 r287  
    88#include <QByteArray>
    99#include <QCoreApplication>
     10#include <QThread>
    1011#include <typeinfo>
    1112
    12 namespace pacpus {
     13namespace pacpus
     14{
    1315
    1416template <typename T, class C>
     
    2830    //typedef boost::function<void (C*, T const&)> process_const_data_function_type;
    2931
     32    void initialize()
     33    {
     34        // each input slot will be processed by a separate thread
     35        moveToThread(&mProcessingThread);
     36        mProcessingThread.start();
     37    }
     38
    3039    InputInterface(QString name, C* component, process_data_function_type_with_event processingMethod)
    3140        : InputInterfaceBase(name, component, component)
    3241    {
    3342        mProcessingMethod.fe = processingMethod;
     43        initialize();
    3444    }
    3545   
     
    3848    {
    3949        mProcessingMethod.f = processingMethod;
     50        initialize();
    4051    }
    4152   
     
    4455    {
    4556        mProcessingMethod.cfe = processingMethod;
     57        initialize();
    4658    }
    4759   
     
    5062    {
    5163        mProcessingMethod.cf = processingMethod;
     64        initialize();
    5265    }
    5366
     
    202215
    203216    ProcessingMethod mProcessingMethod;
     217    QThread mProcessingThread;
    204218};
    205219
     
    249263            it->getPriority()
    250264        );
    251         LOG_TRACE("Sender: " << it->getInterface()->getSignature());
     265        LOG_TRACE("Sender: " << getSignature());
    252266    }
    253267}
Note: See TracChangeset for help on using the changeset viewer.