summaryrefslogtreecommitdiffstats
path: root/lib/libthr/thread/thr_mutexattr.c
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2016-02-28 17:52:33 +0000
committerkib <kib@FreeBSD.org>2016-02-28 17:52:33 +0000
commite76eb4255b957aa73f6228dd8d525d1946e3707d (patch)
tree93354adb0a612a635964c8498072087760a0f93b /lib/libthr/thread/thr_mutexattr.c
parent800b1f3198ded0c65c024ea0cef1f44d4bc59fed (diff)
downloadFreeBSD-src-e76eb4255b957aa73f6228dd8d525d1946e3707d.zip
FreeBSD-src-e76eb4255b957aa73f6228dd8d525d1946e3707d.tar.gz
Implement process-shared locks support for libthr.so.3, without
breaking the ABI. Special value is stored in the lock pointer to indicate shared lock, and offline page in the shared memory is allocated to store the actual lock. Reviewed by: vangyzen (previous version) Discussed with: deischen, emaste, jhb, rwatson, Martin Simmons <martin@lispworks.com> Tested by: pho Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'lib/libthr/thread/thr_mutexattr.c')
-rw-r--r--lib/libthr/thread/thr_mutexattr.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/lib/libthr/thread/thr_mutexattr.c b/lib/libthr/thread/thr_mutexattr.c
index 7c48ed22..fa349cf 100644
--- a/lib/libthr/thread/thr_mutexattr.c
+++ b/lib/libthr/thread/thr_mutexattr.c
@@ -176,8 +176,7 @@ _pthread_mutexattr_getpshared(const pthread_mutexattr_t *attr,
if (attr == NULL || *attr == NULL)
return (EINVAL);
-
- *pshared = PTHREAD_PROCESS_PRIVATE;
+ *pshared = (*attr)->m_pshared;
return (0);
}
@@ -185,13 +184,11 @@ int
_pthread_mutexattr_setpshared(pthread_mutexattr_t *attr, int pshared)
{
- if (attr == NULL || *attr == NULL)
+ if (attr == NULL || *attr == NULL ||
+ (pshared != PTHREAD_PROCESS_PRIVATE &&
+ pshared != PTHREAD_PROCESS_SHARED))
return (EINVAL);
-
- /* Only PTHREAD_PROCESS_PRIVATE is supported. */
- if (pshared != PTHREAD_PROCESS_PRIVATE)
- return (EINVAL);
-
+ (*attr)->m_pshared = pshared;
return (0);
}
OpenPOWER on IntegriCloud