Show Runnable.h syntax highlighted
#ifndef RUNNABLE_H
#define RUNNABLE_H
#include <imap_debug.h>
namespace Middleware
{
class Runnable
{
public:
virtual ~Runnable() {}
virtual void operator()() = 0;
};
/* This seems silly, but thread copies its target, and its target is usually
* RequestProcessor, which is not something I want copied.
*/
template<class T>
class ThreadDelegate : public Runnable
{
boost::shared_ptr<T> target;
public:
ThreadDelegate(const boost::shared_ptr<T> &t) : target(t) {}
ThreadDelegate(const ThreadDelegate& b) {
this->target = b.target;
}
ThreadDelegate &operator=(const ThreadDelegate &b) {
this->target = b.target;
}
void operator()() { (*target)(); }
};
};
#endif
See more files for this project here