diff options
author | Marco S Hyman <marc@cvs.openbsd.org> | 2002-02-17 04:33:34 +0000 |
---|---|---|
committer | Marco S Hyman <marc@cvs.openbsd.org> | 2002-02-17 04:33:34 +0000 |
commit | f3fa53eb6d27bd26edde5be900b5bf620297b4bf (patch) | |
tree | 2414aaecf35a48427cfd4a8a5af9cb897313d76e /regress/lib/libpthread | |
parent | 07b4a7d3e8ab12126dae8c7c4d10537958f5f57e (diff) |
a state variable used by multiple threads needs to be volatile
Diffstat (limited to 'regress/lib/libpthread')
-rw-r--r-- | regress/lib/libpthread/cancel/cancel.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/regress/lib/libpthread/cancel/cancel.c b/regress/lib/libpthread/cancel/cancel.c index 13db747e45d..6f9359246d2 100644 --- a/regress/lib/libpthread/cancel/cancel.c +++ b/regress/lib/libpthread/cancel/cancel.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cancel.c,v 1.3 2001/09/20 16:43:15 todd Exp $ */ +/* $OpenBSD: cancel.c,v 1.4 2002/02/17 04:33:33 marc Exp $ */ /* David Leonard <d@openbsd.org>, 1999. Public Domain. */ #include <pthread.h> @@ -13,7 +13,8 @@ static pthread_cond_t cond; static pthread_mutex_t mutex; static struct timespec expiretime; -static int pv_state = 0; +static volatile int pv_state = 0; + void p() { CHECKr(pthread_mutex_lock(&mutex)); if (pv_state <= 0) { |