BeamMP-Server/include/IThreaded.h
2021-03-18 23:44:14 +02:00

17 lines
336 B
C++

#pragma once
#include <thread>
// pure virtual class to be inherited from by classes which intend to be threaded
class IThreaded {
public:
IThreaded()
// invokes operator() on this object
: mThread(std::thread([this] { (*this)(); })) { }
virtual void operator()() = 0;
protected:
std::thread mThread;
};