Pthread_mutex_destroy Error Codes
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
Pthread_mutex_destroy Example
this site About Us Learn more about Stack Overflow the company Business Learn pthread_mutex_destroy ebusy more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question
Pthread_mutex_destroy Error 16
x Dismiss Join 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 minute: Sign up pthread_mutex_destroy necessary How to handle error conditions of pthread_mutex_destroy up vote 1 down vote favorite When I try to destroy mutex via pthread_mutex_destroy(&mutex), it intermittently fails. I am doing an assert if the pthread_mutex_destroy fails. But do we have a better option compared to assert (apart from raising exception)? EDIT: void cleanUp() { int rval=0; rval = pthread_cond_destroy(&m_Condition); assert(rval == 0); rval = pthread_mutex_destroy(&m_Mutex); assert(rval pthread mutex example == 0); rval = pthread_mutexattr_destroy(&m_Attr); assert(rval == 0); } EDIT 2: void semaphoreVMware::semaphoreVMware() { int rval = 0; rval = pthread_mutexattr_init(&m_Attr); assert(rval == 0); rval = pthread_mutexattr_settype(&m_Attr, PTHREAD_MUTEX_RECURSIVE); assert(rval == 0); rval = pthread_mutex_init(&m_Mutex, &m_Attr); assert(rval == 0); rval = pthread_cond_init(&m_Condition, NULL); assert(rval == 0); } EDIT 3:Declaration of the mutex: env::Mutex m_Mutex; c unix pthreads mutex share|improve this question edited Dec 10 '13 at 13:49 alk 45.1k53497 asked Dec 10 '13 at 6:34 Ravikanth 357 do you know why it is failing? –Glenn Teitelbaum Dec 10 '13 at 6:36 Can you please post some sample code? Can't you check the return value and take an action instead of throwing an assert? –ServerMonkey Dec 10 '13 at 6:37 @ServerMonkey almost all of the errors from pthread_mutex_destroy are programming errors, with the exception of resource limitation, which should not be intermittent. It would be better to fix the problems so that the errors do not occur. –Glenn Teitelbaum Dec 10 '13 at 6:41 Hello,Thanks for your reply.Actually the cleanup code which i have posted gets called whenever we stop our s
Programmer's ManualPTHREAD_MUTEX_DESTROY(3P) PROLOG top This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the corresponding Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux. NAME top pthread_mutex_destroy, pthread_mutex_init — destroy and initialize a mutex SYNOPSIS top #include