I’m getting a segmentation fault when I try to do
pthread_mutex_lock(&_mutex).
This is really odd, I’m not sure what might have caused it. I have initialized _mutex in the constructor with
pthread_mutex_init(&_mutex,NULL).
anything I can do?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
solved it, and I am very annoyed at this.
I wanted to send a Producer* as an argument to the function the Pthread runs, so I used &(*iter), where iter is an iterator that runs on a producers vector.
little did I notice it was (rightfully) a vector< Producer* >, which meant I’ve been sending Producer* * which produced undefined results. grrrrr. Obviously, I didn’t notice this because Pthreads is in pure C and therefor uses void* as it’s only way of accepting any type of arguments.