Changeset 293 in pacpusframework


Ignore:
Timestamp:
Mar 27, 2014, 3:50:21 PM (11 years ago)
Author:
Marek Kurdej
Message:

REVERTED: Reworked threading in InputInterfaceBase, each slot has its own processing thread.

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/examples/ProducerConsumerExample/ConsumerExample.cpp

    r291 r293  
    6060    setState(MONITOR_OK);
    6161    LOG_INFO("started component '" << getName() << "'");
     62
     63    moveToThread(&mThread);
     64    mThread.start();
    6265}
    6366
     
    6972    setState(STOPPED);
    7073    LOG_INFO("stopped component '" << getName() << "'");
     74    QMetaObject::invokeMethod(&mThread, "quit");
    7175}
    7276
  • trunk/examples/ProducerConsumerExample/ConsumerExample.h

    r291 r293  
    77#include <Pacpus/kernel/ComponentBase.h>
    88#include <QImage>
     9#include <QThread>
    910#include <string>
    1011
     
    3738
    3839    std::string mOutputFileName;
     40    QThread mThread;
    3941};
    4042
  • trunk/examples/ProducerConsumerExample/ProducerExample.cpp

    r291 r293  
    1515
    1616PACPUS_REGISTER_COMPONENT(ProducerExample);
    17 
    18 static const char * outputFileName = "producer.txt";
    1917
    2018ProducerExample::ProducerExample(QString name)
     
    6260    using boost::ref;
    6361
    64     std::fstream mFile(outputFileName, std::ios_base::out | std::ios_base::app);
     62    std::fstream mFile(mOutputFileName, std::ios_base::out | std::ios_base::app);
    6563    if (!mFile.is_open()) {
    66         LOG_ERROR("file '" << outputFileName << "' cannot be opened");
     64        LOG_ERROR("file '" << mOutputFileName << "' cannot be opened");
    6765        return;
    6866    }
  • trunk/include/Pacpus/kernel/InputOutputInterface.h

    r290 r293  
    88#include <QByteArray>
    99#include <QCoreApplication>
    10 #include <QThread>
     10//#include <QThread>
    1111#include <typeinfo>
    1212
     
    3333    {
    3434        // each input slot will be processed by a separate thread
    35         moveToThread(&mProcessingThread);
    36         mProcessingThread.start();
     35        //moveToThread(&mProcessingThread);
     36        //mProcessingThread.start();
    3737    }
    3838
     
    215215
    216216    ProcessingMethod mProcessingMethod;
    217     QThread mProcessingThread;
     217    //QThread mProcessingThread;
    218218};
    219219
  • trunk/src/PacpusLib/InputOutputBase.cpp

    r291 r293  
    7272
    7373InputInterfaceBase::InputInterfaceBase(QString name, ComponentBase * component, QObject * parent)
    74     : AbstractInterface(name, component, /*parent*/ NULL)
     74    : AbstractInterface(name, component, parent)
    7575{
    7676}
Note: See TracChangeset for help on using the changeset viewer.