diff options
author | Robert Mustacchi <rm@joyent.com> | 2017-01-19 16:25:56 +0000 |
---|---|---|
committer | Robert Mustacchi <rm@joyent.com> | 2017-06-20 15:44:37 +0000 |
commit | cdcc9e2ce0563ac9f9076ee350d4fd008f61f1eb (patch) | |
tree | c5e64f3b5ec3335d0570f171283ec99a01f9d572 | |
parent | 192a5ca9fe8b81784c9921860f876735fc9a1e3e (diff) | |
download | illumos-joyent-cdcc9e2ce0563ac9f9076ee350d4fd008f61f1eb.tar.gz |
8349 thrd_equal implements the wrong specification
Reviewed by: Patrick Mooney <patrick.mooney@joyent.com>
Reviewed by: Andy Stormont <astormont@racktopsystems.com>
Reviewed by: Toomas Soome <tsoome@me.com>
Approved by: Dan McDonald <danmcd@joyent.com>
-rw-r--r-- | usr/src/lib/libc/port/threads/c11_thr.c | 6 | ||||
-rw-r--r-- | usr/src/man/man3c/thrd_equal.3c | 10 | ||||
-rw-r--r-- | usr/src/test/libc-tests/tests/c11_threads.c | 10 |
3 files changed, 14 insertions, 12 deletions
diff --git a/usr/src/lib/libc/port/threads/c11_thr.c b/usr/src/lib/libc/port/threads/c11_thr.c index 6a8c6d157e..a33fa12743 100644 --- a/usr/src/lib/libc/port/threads/c11_thr.c +++ b/usr/src/lib/libc/port/threads/c11_thr.c @@ -10,7 +10,7 @@ */ /* - * Copyright 2016 Joyent, Inc. + * Copyright 2017 Joyent, Inc. */ #include <pthread.h> @@ -156,7 +156,7 @@ mtx_lock(mtx_t *mtx) int mtx_timedlock(mtx_t *_RESTRICT_KYWD mtx, - const struct timespec *_RESTRICT_KYWD abstime) + const struct timespec *_RESTRICT_KYWD abstime) { int ret; @@ -221,7 +221,7 @@ thrd_detach(thrd_t thr) int thrd_equal(thrd_t t1, thrd_t t2) { - return (!pthread_equal(t1, t2)); + return (pthread_equal(t1, t2)); } _NORETURN_KYWD void diff --git a/usr/src/man/man3c/thrd_equal.3c b/usr/src/man/man3c/thrd_equal.3c index 0ceec884b8..28c6baeb1f 100644 --- a/usr/src/man/man3c/thrd_equal.3c +++ b/usr/src/man/man3c/thrd_equal.3c @@ -9,9 +9,9 @@ .\" http://www.illumos.org/license/CDDL. .\" .\" -.\" Copyright 2016 Joyent, Inc. +.\" Copyright 2017 Joyent, Inc. .\" -.Dd "Jan 11, 2015" +.Dd "Jan 19, 2017" .Dt THRD_EQUAL 3C .Os .Sh NAME @@ -36,13 +36,15 @@ and determines whether or not they refer to the same thread. The .Fn thrd_equal function returns -.Sy 0 +.Sy non-zero if .Fa thrd0 and .Fa thrd1 refer to the same thread. -Otherwise, a non-zero value is returned, indicating that +Otherwise, +.Sy 0 +is returned, indicating that .Fa thrd0 and .Fa thrd1 diff --git a/usr/src/test/libc-tests/tests/c11_threads.c b/usr/src/test/libc-tests/tests/c11_threads.c index dffadcc2af..2f96bcbd89 100644 --- a/usr/src/test/libc-tests/tests/c11_threads.c +++ b/usr/src/test/libc-tests/tests/c11_threads.c @@ -10,7 +10,7 @@ */ /* - * Copyright 2016 Joyent, Inc. + * Copyright 2017 Joyent, Inc. */ /* @@ -144,11 +144,11 @@ cthr_test_equal(void) self = thrd_current(); - VERIFY0(thrd_equal(self, self)); + VERIFY3S(thrd_equal(self, self), !=, 0); VERIFY3S(thrd_create(&other, cthr_test_sleep_thr, NULL), ==, thrd_success); - VERIFY3S(thrd_equal(self, other), !=, 0); - VERIFY3S(thrd_equal(other, other), ==, 0); + VERIFY3S(thrd_equal(self, other), ==, 0); + VERIFY3S(thrd_equal(other, other), !=, 0); VERIFY3S(thrd_detach(other), ==, thrd_success); } @@ -159,7 +159,7 @@ cthr_test_detach_err(void) self = thrd_current(); - VERIFY0(thrd_equal(self, self)); + VERIFY3S(thrd_equal(self, self), !=, 0); VERIFY3S(thrd_create(&other, cthr_test_sleep_thr, NULL), ==, thrd_success); VERIFY3S(thrd_detach(other), ==, thrd_success); |