summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog2
-rw-r--r--misc.c10
-rw-r--r--tests/equal1.c2
3 files changed, 8 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 722ef68..4871eea 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
Sat Feb 18 16:2s1703:30 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+ * misc.c (pthread_equal): Fix inverted result.
+
* Makefile.in: Use libpthread32.a as the name of the DLL export
library instead of pthread.lib.
diff --git a/misc.c b/misc.c
index 1b558f4..025653c 100644
--- a/misc.c
+++ b/misc.c
@@ -172,19 +172,19 @@ pthread_equal (pthread_t t1, pthread_t t2)
*
*
* DESCRIPTION
- * This function returns zero if t1 and t2 are equal, else
- * returns nonzero.
+ * This function returns nonzero if t1 and t2 are equal, else
+ * returns zero.
*
* RESULTS
- * 0 if t1 and t2 refer to the same thread,
- * non-zero t1 and t2 do not refer to the same thread
+ * non-zero if t1 and t2 refer to the same thread,
+ * 0 t1 and t2 do not refer to the same thread
*
* ------------------------------------------------------
*/
{
int result;
- result = !((t1 == t2) || (t1->thread == t2->thread));
+ result = ((t1 == t2) && (t1->thread == t2->thread));
return (result);
diff --git a/tests/equal1.c b/tests/equal1.c
index 3b4c758..e877990 100644
--- a/tests/equal1.c
+++ b/tests/equal1.c
@@ -14,7 +14,7 @@ main()
int rc;
pthread_t t1, t2;
rc = pthread_create(&t1, NULL, func, (void *) 1);
- rc = pthread_create(&t1, NULL, func, (void *) 2);
+ rc = pthread_create(&t2, NULL, func, (void *) 2);
puts("testing t1 and t2: ");
if (pthread_equal(t1, t2))