Explain that pthread_rwlock_unlock may crash if called on a lock not
held by the current thread.
+2016-10-28 Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>
+
+ * nptl/pthread_rwlock_unlock.c: Add a comment explaining its
+ behavior when eliding a lock not held by the current thread.
+ * sysdeps/powerpc/nptl/elide.h: Likewise.
+
2016-10-28 Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>
[BZ #20728]
LIBC_PROBE (rwlock_unlock, 1, rwlock);
+ /* Trying to elide an unlocked lock may crash the process. This
+ is expected and is compatible with POSIX.1-2008: "results are
+ undefined if the read-write lock rwlock is not held by the
+ calling thread". */
if (ELIDE_UNLOCK (rwlock->__data.__writer == 0
&& rwlock->__data.__nr_readers == 0))
return 0;
{
if (is_lock_free)
{
+ /* This code is expected to crash when trying to unlock a lock not
+ held by this thread. More information is available in the
+ __pthread_rwlock_unlock() implementation. */
__libc_tend (0);
return true;
}