class Scoreget{
private:
//some variables
public:
Scoreget(){
//something here
}
void* basicgetscore(){
Declare it static, and add another helper method:
static void* basicgetscore(void * object){
return ((Scoreget *) object)->dobasicgetscore();
}
void * dobasicgetscore() // new helper method
{
// do stuff here
return NULL;
}
create pthread with:
if (pthread_create(&t,NULL,basicgetscore,&s) == -1) { ...
Also, be very careful. You're giving this thread the address of a temporary variable. It's safe in this specific case because the pthread_join is in the same function, but if you were to return from the function before the thread exits, you'll deallocate the object you're running the thread inside, which could result in all kinds of nasty behavior. Consider updating your function to either 1) take a reference or pointer or 2) operate on this
.