aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Xu <davidxu@FreeBSD.org>2003-09-14 22:32:28 +0000
committerDavid Xu <davidxu@FreeBSD.org>2003-09-14 22:32:28 +0000
commitc5f1d9f6f8efb51ffdf0d1cfd440b72d683364ed (patch)
tree83846d79abc00580924f7f3238800e207964dc40
parentfba3db9f57b7076c6a8fa3a80eb2cf316724e508 (diff)
downloadsrc-c5f1d9f6f8efb51ffdf0d1cfd440b72d683364ed.tar.gz
src-c5f1d9f6f8efb51ffdf0d1cfd440b72d683364ed.zip
If user is seting scope process flag, clear PTHREAD_SCOPE_SYSTEM bit
accordingly. Reviewed by: deischen
Notes
Notes: svn path=/head/; revision=120068
-rw-r--r--lib/libkse/thread/thr_attr_setscope.c6
-rw-r--r--lib/libpthread/thread/thr_attr_setscope.c6
2 files changed, 8 insertions, 4 deletions
diff --git a/lib/libkse/thread/thr_attr_setscope.c b/lib/libkse/thread/thr_attr_setscope.c
index 70dd69e5e6c0..dcf179e290e4 100644
--- a/lib/libkse/thread/thr_attr_setscope.c
+++ b/lib/libkse/thread/thr_attr_setscope.c
@@ -48,8 +48,10 @@ _pthread_attr_setscope(pthread_attr_t *attr, int contentionscope)
} else if ((contentionscope != PTHREAD_SCOPE_PROCESS) &&
(contentionscope != PTHREAD_SCOPE_SYSTEM)) {
ret = EINVAL;
- } else
+ } else if (contentionscope == PTHREAD_SCOPE_SYSTEM) {
(*attr)->flags |= contentionscope;
-
+ } else {
+ (*attr)->flags &= ~PTHREAD_SCOPE_SYSTEM;
+ }
return (ret);
}
diff --git a/lib/libpthread/thread/thr_attr_setscope.c b/lib/libpthread/thread/thr_attr_setscope.c
index 70dd69e5e6c0..dcf179e290e4 100644
--- a/lib/libpthread/thread/thr_attr_setscope.c
+++ b/lib/libpthread/thread/thr_attr_setscope.c
@@ -48,8 +48,10 @@ _pthread_attr_setscope(pthread_attr_t *attr, int contentionscope)
} else if ((contentionscope != PTHREAD_SCOPE_PROCESS) &&
(contentionscope != PTHREAD_SCOPE_SYSTEM)) {
ret = EINVAL;
- } else
+ } else if (contentionscope == PTHREAD_SCOPE_SYSTEM) {
(*attr)->flags |= contentionscope;
-
+ } else {
+ (*attr)->flags &= ~PTHREAD_SCOPE_SYSTEM;
+ }
return (ret);
}