diff options
author | green <green@FreeBSD.org> | 2004-10-31 05:03:50 +0000 |
---|---|---|
committer | green <green@FreeBSD.org> | 2004-10-31 05:03:50 +0000 |
commit | 63795987cfb04837f6bf6fc6cbd44b3d8f71cfd2 (patch) | |
tree | 17aae58e9fcd3d6837bc175b203a52bb91fca30a /lib | |
parent | 6972147914e4379cbbfd982d450f55afcdb2044e (diff) | |
download | FreeBSD-src-63795987cfb04837f6bf6fc6cbd44b3d8f71cfd2.zip FreeBSD-src-63795987cfb04837f6bf6fc6cbd44b3d8f71cfd2.tar.gz |
Make pthread_mutex_trylock(3) return EBUSY on failure, as all software
packages expect and seems to be most correct according to the slightly-
ambiguous standards.
MFC after: 1 month
Corroborated by: POSIX <http://tinyurl.com/4uvub>
Reviewed by: silence on threads@
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libkse/thread/thr_mutex.c | 9 | ||||
-rw-r--r-- | lib/libpthread/thread/thr_mutex.c | 9 |
2 files changed, 2 insertions, 16 deletions
diff --git a/lib/libkse/thread/thr_mutex.c b/lib/libkse/thread/thr_mutex.c index 1232f33..047dca5 100644 --- a/lib/libkse/thread/thr_mutex.c +++ b/lib/libkse/thread/thr_mutex.c @@ -911,14 +911,7 @@ mutex_self_trylock(struct pthread *curthread, pthread_mutex_t m) /* case PTHREAD_MUTEX_DEFAULT: */ case PTHREAD_MUTEX_ERRORCHECK: case PTHREAD_MUTEX_NORMAL: - /* - * POSIX specifies that mutexes should return EDEADLK if a - * recursive lock is detected. - */ - if (m->m_owner == curthread) - ret = EDEADLK; - else - ret = EBUSY; + ret = EBUSY; break; case PTHREAD_MUTEX_RECURSIVE: diff --git a/lib/libpthread/thread/thr_mutex.c b/lib/libpthread/thread/thr_mutex.c index 1232f33..047dca5 100644 --- a/lib/libpthread/thread/thr_mutex.c +++ b/lib/libpthread/thread/thr_mutex.c @@ -911,14 +911,7 @@ mutex_self_trylock(struct pthread *curthread, pthread_mutex_t m) /* case PTHREAD_MUTEX_DEFAULT: */ case PTHREAD_MUTEX_ERRORCHECK: case PTHREAD_MUTEX_NORMAL: - /* - * POSIX specifies that mutexes should return EDEADLK if a - * recursive lock is detected. - */ - if (m->m_owner == curthread) - ret = EDEADLK; - else - ret = EBUSY; + ret = EBUSY; break; case PTHREAD_MUTEX_RECURSIVE: |