summaryrefslogtreecommitdiff
path: root/misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'misc.c')
-rw-r--r--misc.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/misc.c b/misc.c
index 724bbc2..e79819d 100644
--- a/misc.c
+++ b/misc.c
@@ -229,7 +229,11 @@ pthread_equal (pthread_t t1, pthread_t t2)
{
int result;
- result = ((t1 == t2) && (t1->thread == t2->thread));
+ /*
+ * We also accept NULL == NULL - treating NULL as a thread
+ * for this special case, because there is no error that we can return.
+ */
+ result = ( ( t1 == t2 ) && ( t1 == NULL || ( t1->thread == t2->thread ) ) );
return (result);
@@ -260,8 +264,7 @@ ptw32_cancelable_wait (HANDLE waitHandle, DWORD timeout)
handles[0] = waitHandle;
- if ((self = (pthread_t) pthread_getspecific (ptw32_selfThreadKey))
- != NULL)
+ if ((self = pthread_self()) != NULL)
{
/*
* Get cancelEvent handle