I've tried compiling this with these three routines for the thread issue:
Code:
void HDListen::listenthread() {//protected
readinfile();
ioport.closeport();
return;
}
void *HDListen::StartHDListener(void *ctx) {//protected
HDListen *hdl = static_cast<HDListen *>(ctx);
return hdl->listenthread();
}
void HDListen::listentoradio() {//public
pthread_create(&listenThread, NULL, StartHDListener, this);
return;
}
I have this in the header:
Code:
class HDListen {
pthread_t listenThread;
LinuxPort ioport;
public:
HDListen(LinuxPort);
void listentoradio();
protected:
void listenthread();
void *StartHDListener(void*);
};
When I compile it, here's what I get:
[hal@wizard:HD Radio Controller]$ g++ -c -lpthread -D_REENTRANT hdlisten.cpp
hdlisten.cpp: In member function ‘void* HDListen::StartHDListener(void*)’:
hdlisten.cpp:398: error: void value not ignored as it ought to be
hdlisten.cpp: In member function ‘void HDListen::listentoradio()’:
hdlisten.cpp:402: error: argument of type ‘void* (HDListen:(void*)’ does not match ‘void* (*)(void*)’
Line 398 is the last line of StartHDListener(), with the return function, and line 402 is the line with the pthread_create() function. Should the return type be something other than void?