在编译时,我得到了这个错误
expected 'union pthread_mutex_t *' but argument is type of 'pthread_mutex_t'
1)'union pthread_mutex_t *'和'pthread_mutex_t'有什么区别?
2)我如何将'pthread_mutex_t'变成正确的参数?
void buffer_insert(int number)
{
pthread_mutex_t padlock;
pthread_cond_t non_full;
pthread_mutex_init(&padlock, NULL);
pthread_cond_init(&non_full, NULL);
if(available_buffer()){
put_in_buffer(number);
} else {
pthread_mutex_lock(padlock);
pthread_cond_wait(non_full, padlock);
put_in_buffer(number);
pthread_mutex_unlock(padlock);
pthread_cond_signal(non_empty);
}
}