summaryrefslogtreecommitdiff
path: root/sem_timedwait.c
diff options
context:
space:
mode:
authorrpj <rpj>2002-07-30 17:18:25 +0000
committerrpj <rpj>2002-07-30 17:18:25 +0000
commitd9bad66cbb8823ad786ac480330db1c05e85557a (patch)
tree512085bea583cab23c9f32646921fbda66aa447d /sem_timedwait.c
parentccd0f86e370fa71acd47c17cb9579877403c81d1 (diff)
* pthread_cond_wait.c (ptw32_cond_wait_cleanup):
Remove code designed to avoid/prevent spurious wakeup problems. It is believed that the sem_timedwait() call is consuming a CV signal that it shouldn't and this is breaking the avoidance logic.
Diffstat (limited to 'sem_timedwait.c')
-rw-r--r--sem_timedwait.c62
1 files changed, 31 insertions, 31 deletions
diff --git a/sem_timedwait.c b/sem_timedwait.c
index a6fc753..cc4de4a 100644
--- a/sem_timedwait.c
+++ b/sem_timedwait.c
@@ -13,32 +13,32 @@
*
* --------------------------------------------------------------------------
*
- * Pthreads-win32 - POSIX Threads Library for Win32
- * Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2002 Pthreads-win32 contributors
+ * Pthreads-win32 - POSIX Threads Library for Win32
+ * Copyright(C) 1998 John E. Bossom
+ * Copyright(C) 1999,2002 Pthreads-win32 contributors
*
- * Contact Email: rpj@ise.canberra.edu.au
+ * Contact Email: rpj@ise.canberra.edu.au
*
- * The current list of contributors is contained
- * in the file CONTRIBUTORS included with the source
- * code distribution. The list can also be seen at the
- * following World Wide Web location:
- * http://sources.redhat.com/pthreads-win32/contributors.html
+ * The current list of contributors is contained
+ * in the file CONTRIBUTORS included with the source
+ * code distribution. The list can also be seen at the
+ * following World Wide Web location:
+ * http://sources.redhat.com/pthreads-win32/contributors.html
*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
*
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library in the file COPYING.LIB;
- * if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library in the file COPYING.LIB;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifndef _UWIN
@@ -141,10 +141,10 @@ sem_timedwait (sem_t * sem, const struct timespec * abstime)
* GetSystemTimeAsFileTime(&ft); would be faster,
* but it does not exist on WinCE
*/
-
+
ptw32_filetime_to_timespec(&ft, &currSysTime);
}
-
+
/*
* subtract current system time from abstime in a way that checks
* that abstime is never in the past, or is never equivalent to the
@@ -154,7 +154,7 @@ sem_timedwait (sem_t * sem, const struct timespec * abstime)
{
DWORD tmpMilliseconds;
DWORD tmpCurrMilliseconds;
-
+
tmpMilliseconds = (abstime->tv_sec - currSysTime.tv_sec) * MILLISEC_PER_SEC;
tmpMilliseconds += ((abstime->tv_nsec + (NANOSEC_PER_MILLISEC/2))
/ NANOSEC_PER_MILLISEC);
@@ -169,10 +169,10 @@ sem_timedwait (sem_t * sem, const struct timespec * abstime)
}
}
}
-
+
#else /* NEED_FTIME */
_ftime(&currSysTime);
-
+
/*
* subtract current system time from abstime in a way that checks
* that abstime is never in the past, or is never equivalent to the
@@ -181,11 +181,11 @@ sem_timedwait (sem_t * sem, const struct timespec * abstime)
if (abstime->tv_sec >= currSysTime.time)
{
DWORD tmpMilliseconds;
-
+
tmpMilliseconds = (abstime->tv_sec - currSysTime.time) * MILLISEC_PER_SEC;
tmpMilliseconds += ((abstime->tv_nsec + (NANOSEC_PER_MILLISEC/2))
/ NANOSEC_PER_MILLISEC);
- if (tmpMilliseconds > currSysTime.millitm)
+ if (tmpMilliseconds > (DWORD) currSysTime.millitm)
{
milliseconds = tmpMilliseconds - currSysTime.millitm;
if (milliseconds == INFINITE)
@@ -194,11 +194,11 @@ sem_timedwait (sem_t * sem, const struct timespec * abstime)
}
}
}
-
+
#endif /* NEED_FTIME */
-
+
}
-
+
#ifdef NEED_SEM
result = (pthreadCancelableTimedWait ((*sem)->event, milliseconds));