template class Poco::RunnableAdapter

Overview

This adapter simplifies using ordinary methods as targets for threads. Moreā€¦

#include <RunnableAdapter.h>

template <class C>
class RunnableAdapter: public Poco::Runnable
{
public:
    // typedefs

    typedef void(C::* Callback)();

    // construction

    RunnableAdapter(
        C& object,
        Callback method
        );

    RunnableAdapter(const RunnableAdapter& ra);

    // methods

    RunnableAdapter&
    operator=(const RunnableAdapter& ra);

    virtual
    void
    run();
};

Inherited Members

public:
    // methods

    virtual
    void
    run() = 0;

Detailed Documentation

This adapter simplifies using ordinary methods as targets for threads.

Usage:

RunnableAdapter<MyClass> ra(myObject, &MyObject::doSomething));
Thread thr;
thr.Start(ra);

For using a freestanding or static member function as a thread target, please see the ThreadTarget class.

Methods

virtual
void
run()

Do whatever the thread needs to do.

Must be overridden by subclasses.