が、私は方法「リーダー」とクラス「セマフォ」を作成し、この方法:私のmain.cppには"無効な値は無視されません" - 何が間違っていますか?
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);
}
次のように、私はこれらの補助変数を作成し、私のクラスをインスタンス化:
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);
これにより
は、私は次のエラーを取得する:
void value not ignored as it ought to be
どのラインで正確にエラーが発生しますか? –