+2013-07-02 Andi Kleen <ak@linux.intel.com>
+
+ * tst-mutex5.c: Include config.h.
+ (do_test): Add checks for ENABLE_LOCK_ELISION.
+ * tst-mutex8.c: Include config.h
+ (tf): Add checks for ENABLE_LOCK_ELISION.
+ (check_type): Likewise.
+
2013-07-02 Andi Kleen <ak@linux.intel.com>
* pthreadP.h: Add elision types.
#include <time.h>
#include <unistd.h>
#include <sys/time.h>
+#include <config.h>
#ifndef TYPE
return 1;
}
+ /* Elided locks do not time out. */
+#ifdef ENABLE_LOCK_ELISION
if (pthread_mutex_trylock (&m) == 0)
{
puts ("mutex_trylock succeeded");
puts ("3rd timedlock didn't return right away");
return 1;
}
+#endif
if (pthread_mutex_unlock (&m) != 0)
{
static int
check_type (const char *mas, pthread_mutexattr_t *ma)
{
+ int e __attribute__((unused));
+
if (pthread_mutex_init (m, ma) != 0)
{
printf ("1st mutex_init failed for %s\n", mas);
return 1;
}
- int e = pthread_mutex_destroy (m);
+ /* Elided mutexes don't fail destroy. If elision is not explicitly disabled
+ we don't know, so can also not check this. */
+#ifndef ENABLE_LOCK_ELISION
+ e = pthread_mutex_destroy (m);
if (e == 0)
{
printf ("mutex_destroy of self-locked mutex succeeded for %s\n", mas);
mas);
return 1;
}
+#endif
if (pthread_mutex_unlock (m) != 0)
{
return 1;
}
+ /* Elided mutexes don't fail destroy. */
+#ifndef ENABLE_LOCK_ELISION
e = pthread_mutex_destroy (m);
if (e == 0)
{
mas);
return 1;
}
+#endif
if (pthread_mutex_unlock (m) != 0)
{
return 1;
}
+ /* Elided mutexes don't fail destroy. */
+#ifndef ENABLE_LOCK_ELISION
e = pthread_mutex_destroy (m);
if (e == 0)
{
mutex_destroy of condvar-used mutex did not return EBUSY for %s\n", mas);
return 1;
}
+#endif
done = true;
if (pthread_cond_signal (&c) != 0)
return 1;
}
+ /* Elided mutexes don't fail destroy. */
+#ifndef ENABLE_LOCK_ELISION
e = pthread_mutex_destroy (m);
if (e == 0)
{
mas);
return 1;
}
+#endif
if (pthread_cancel (th) != 0)
{