diff options
author | Ted Unangst <tedu@cvs.openbsd.org> | 2005-12-19 05:22:58 +0000 |
---|---|---|
committer | Ted Unangst <tedu@cvs.openbsd.org> | 2005-12-19 05:22:58 +0000 |
commit | daa9b064a328487f6d7c1ea9da14fa9490977332 (patch) | |
tree | cca690e15b16f211c03b3768f3359f7883c470ba | |
parent | e4f8c52835283c98aeb37e3a224c13e66fd99f2a (diff) |
after mutex_unlock, there's no guarantee that a waiting thread will
start running. calling pthread_yield makes test pass with rthreads
-rw-r--r-- | regress/lib/libpthread/pthread_mutex/pthread_mutex.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/regress/lib/libpthread/pthread_mutex/pthread_mutex.c b/regress/lib/libpthread/pthread_mutex/pthread_mutex.c index 98121236acc..8804cba8755 100644 --- a/regress/lib/libpthread/pthread_mutex/pthread_mutex.c +++ b/regress/lib/libpthread/pthread_mutex/pthread_mutex.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pthread_mutex.c,v 1.5 2005/10/30 23:59:43 fgsch Exp $ */ +/* $OpenBSD: pthread_mutex.c,v 1.6 2005/12/19 05:22:57 tedu Exp $ */ /* * Copyright (c) 1993, 1994, 1995, 1996 by Chris Provenzano and contributors, * proven@mit.edu All rights reserved. @@ -75,6 +75,7 @@ test_contention_lock(pthread_mutex_t *mutex) pthread_yield(); contention_variable = 1; CHECKr(pthread_mutex_unlock(mutex)); + pthread_yield(); CHECKr(pthread_mutex_lock(mutex)); ASSERT(contention_variable == 2); CHECKr(pthread_mutex_unlock(mutex)); |