I’d like to achieve something similar to interface Runnable from Java. I try to do that in that way:
class Runnable{
public:
void start(){
t = std::thread(&Runnable::run, this);
}
protected:
virtual void run(){
}
};
Idea is simple. I’d like to overload run method and then start() should launch overloaded one. But… it doesn’t work.
terminate called after throwing an instance of 'std::system_error'
what(): Operation not permitted
PS I load an instance of class, which derives from Runnable, from dynamic library with dlopen.
This error is commonly seen produced by GCC when forgetting to use
-pthreadat command line.