I created a class "semaphore" with a method "reader" this way:
void semaforo::reader(sem_t x, sem_t y,sem_t z,sem_t rsem,sem_t wsem){
cout<<"----------------"<<endl;
cout<<"Leitor esta Lendo"<<endl;
sem_wait(&z);
sem_wait(&rsem);
sem_wait(&x);
int aux = readcountM(0);
if(aux ==1){
sem_wait(&wsem);
}
sem_post(&x);
sem_post(&rsem);
sem_post(&z);
prints(1);
sem_wait(&x);
aux = readcountN(aux);
if(aux == 0){
sem_post(&wsem);
}
sem_post(&x);
}
In my main.cpp, I created these auxiliary variables, and instanced my class as follows:
sem_t x,y,z,rsem,wsem;
pthread_t read[3],write[2];
thread *teste2 = new thread();
// the following line triggers the error
teste2->pthread_creation(&read[0],NULL,(void *)teste->reader(x, y, z, rsem, wsem),NULL);
With this I get the following error:
void value not ignored as it ought to be