Home > pthread cond wait error > pthread_cond_wait error code 22

Pthread_cond_wait Error Code 22

Contents

here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting pthread_cond_timedwait return value ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join

Pthread_cond_timedwait Example

the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a einval minute: Sign up pthread_mutex_lock returns invalid argument up vote 4 down vote favorite I am working on some C code and am having a problem with locking a mutex. The code does a call to a function and this function locks pthread_mutex_init a mutex to ensure a file pointer doesn't get overwritten, this works fine for several instances, probably about 10-20 separate calls of the function being called, but on the next call, pthread_mutex_lock will return with a result of 22. I've then put this result into strerror(); and got back invalid argument. What does invalid argument means, thanks for any help you can provide. c debugging pthreads mutex share|improve this question edited Oct 8 '12 at 12:43 vy32 9,0311661128 asked Oct 8 '12 at 12:39 Boardy 9,90554168284 add a comment| 2 Answers 2 active oldest votes up vote 4 down vote accepted Sounds like you have a threading problem or a wild point somewhere else in your program. Try printing the value of the mutex pointer. Try having another thread that simply locks the mutex and then prints to a log file the time and that the lock was successful, then unlocks the mutex. I suspect the problem is not where you are looking. Also, as other have said here, your best bet is to create a very small test program that demonstrates the problem and post it here. Chances are you won't be able to get that small program to demonstrate the error. Then slowly add all of your original code into the small program until the error returns. If it returns, you now know what caused the problem. If it doesn't return, you're done. share|improve this answer answered Oct 8 '12 at 12:43 vy32 9,0311661128 add a comment| up vote 7 down vote 22 is ENVAL error code which means invlalid argument. Make sure that you have initilized you mutex, or if at some point you have unitilized it somewhere. Also man pthread_mutex_lock says: EINVAL The mutex was created with the protocol attribute having the value PTHREAD_PRIO_PROTECT and the calling thread's priority is higher than the mutex's current priority ceiling. I don't quite understand this but it probably means that you need to change thread's pr

and ensure that your hosting provider's database server is running. For more help, see the handbook, or contact your hosting provider.The mysqli error was: Too many connections.

 

Related content

No related pages.