Pthread_cond_timedwait Error Code 22
Contents |
false positive Summary pthread_cond_timedwait failure leads to not-locked
Pthread_cond_timedwait Return Value
false positive Status VERIFIED FIXED Product: valgrind Classification: Unclassified pthread_cond_timedwait example Component: helgrind Version: 3.6.0 Platform: Ubuntu Packages Linux Importance: NOR normal (vote) TargetMilestone: ---
Einval
Assigned To: Julian Seward URL: Keywords: Depends on: Blocks: Show dependency tree /graph Reported: 2011-04-28 13:49 UTC by Magnus Reftel Modified: 2011-11-17 12:11 UTC (History) CC List: 0 users See Also: Latest Commit: Version Fixed In: Description Magnus Reftel 2011-04-28 13:49:53 UTC If the abstime argument to pthread_cond_timedwait is invalid (e.g. nsec is greater than 1000000000), then a subsequent release of the mutex involved is incorrectly reported as an error. See testcase below. ~/src/helgrindbug$ cat fail.c #include
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.
wait on a condition SYNOPSIS [THR] #include http://pubs.opengroup.org/onlinepubs/009695399/functions/pthread_cond_timedwait.html <pthread.h>
int pthread_cond_timedwait(pthread_cond_t *restrict cond,
pthread_mutex_t *restrict mutex,
const struct timespec *restrict abstime);
int pthread_cond_wait(pthread_cond_t *restrict cond,
pthread_mutex_t *restrict mutex); DESCRIPTION The pthread_cond_timedwait() and pthread_cond_wait() functions shall block on a condition variable. They shall be called with pthread_cond_timedwait error mutex locked by the calling thread or undefined behavior results. These functions atomically release mutex and cause the calling thread to block on the condition variable cond; atomically here means "atomically with respect to access by another thread to the mutex and then the condition variable". That is, if pthread_cond_timedwait error code another thread is able to acquire the mutex after the about-to-block thread has released it, then a subsequent call to pthread_cond_broadcast() or pthread_cond_signal() in that thread shall behave as if it were issued after the about-to-block thread has blocked. Upon successful return, the mutex shall have been locked and shall be owned by the calling thread. When using condition variables there is always a Boolean predicate involving shared variables associated with each condition wait that is true if the thread should proceed. Spurious wakeups from the pthread_cond_timedwait() or pthread_cond_wait() functions may occur. Since the return from pthread_cond_timedwait() or pthread_cond_wait() does not imply anything about the value of this predicate, the predicate should be re-evaluated upon such return. When a thread waits on a condition variable, having specified a particular mutex to either the pthread_cond_timedwait() or the pthread_cond_wait() operation, a dynamic binding is fo