Show Runnable.h syntax highlighted
#ifndef RUNNABLE_H
#define RUNNABLE_H
#ifdef CWDEBUG
#include "sys.h"
#include "debug.h"
#endif
namespace Middleware
{
class Runnable
{
public:
virtual ~Runnable() {}
virtual void operator()() = 0;
};
template<class T>
class ThreadDelegate : public Runnable
{
T *target;
public:
ThreadDelegate(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