[Bug 234805] pthread_*_destroy doesn't handle locked objects consistently

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Wed Jan 9 21:22:05 UTC 2019


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=234805

            Bug ID: 234805
           Summary: pthread_*_destroy doesn't handle locked objects
                    consistently
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs at FreeBSD.org
          Reporter: markj at FreeBSD.org

The POSIX entry for pthread_cond_destroy() says, "attempting to destroy a
condition variable upon which other threads are currently blocked results in
undefined behavior."  Our man page does not say this and instead documents an
error code of EBUSY as meaning "the variable cond is locked by another thread."
 However, the code does not attempt to detect this case and simply indicates
success.

OTOH, pthread_mutex_destroy() does check for this case and returns EBUSY. 
pthread_rwlock_destroy() has the same behaviour as pthread_cond_destroy(), and
the compat10 sem_destroy() behaves like pthread_mutex_destroy().  We should be
consistent about this.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list