I curently have an issue when using c++ thread. I have the following error :
/usr/include/c++/4.8/thread:140:47: required from ‘std::thread::thread(_Callable&&, _Args&& ...) [with _Callable = void (TextMove::*)(); _Args = {}]’
textMove.cc:8:40: required from here
/usr/include/c++/4.8/functional:1697:61: error: no type named ‘type’ in ‘class std::result_of<std::_Mem_fn<void (TextMove::*)()>()>’
typedef typename result_of<_Callable(_Args...)>::type result_type;
^
/usr/include/c++/4.8/functional:1727:9: error: no type named ‘type’ in ‘class std::result_of<std::_Mem_fn<void (TextMove::*)()>()>’
_M_invoke(_Index_tuple<_Indices...>)
But my code seems to use correctly the functions :
class TextMove : Text{
public:
TextMove(Viewport *v,rgb_matrix::VFont *f,rgb_matrix::Color *c,rgb_matrix::Color *bg,char* content,int extra) : Text(v,f,0,0,c,bg,content,extra){
index = 0;
limit = v->getX();
}
void play(int speed);
void playThread(int speed);
private:
void draw();
int index;
pthread_t thread;
int limit;
};
void TextMove::play(int speed){
std::thread t(&TextMove::playThread,speed);
t.join();
}
void TextMove::playThread(int speed) {
index = 0;
while(_x>limit){
draw();
sleep(speed);
_x--;
}
}
I dont know if it's because I am using it in a class but I have not found the problem for now.