summaryrefslogtreecommitdiff
path: root/gthread
diff options
context:
space:
mode:
authorTor Lillqvist <tml@iki.fi>2002-11-25 23:08:27 +0000
committerTor Lillqvist <tml@src.gnome.org>2002-11-25 23:08:27 +0000
commitf87a83cc158578001a766d5ce56fc9b6c11585a9 (patch)
treeea65c71a6d7359ec77f50e05a1e7be4af20ed5e5 /gthread
parent4009574b70564ae9f04e8407b76e7a970de18066 (diff)
Fix two bugs: 1) If abs_time is NULL, should use infinite time. 2) Check
2002-11-23 Tor Lillqvist <tml@iki.fi> * gthread-win32.c (g_cond_timed_wait_win32_impl): Fix two bugs: 1) If abs_time is NULL, should use infinite time. 2) Check for current time already being past abs_time. (#99294, Christopher R. Palmer, fix by Sebastian Wilhelmi)
Diffstat (limited to 'gthread')
-rw-r--r--gthread/ChangeLog7
-rw-r--r--gthread/gthread-win32.c18
2 files changed, 21 insertions, 4 deletions
diff --git a/gthread/ChangeLog b/gthread/ChangeLog
index c306b3954..8b98a12fb 100644
--- a/gthread/ChangeLog
+++ b/gthread/ChangeLog
@@ -1,3 +1,10 @@
+2002-11-23 Tor Lillqvist <tml@iki.fi>
+
+ * gthread-win32.c (g_cond_timed_wait_win32_impl): Fix two bugs: 1)
+ If abs_time is NULL, should use infinite time. 2) Check for
+ current time already being past abs_time. (#99294, Christopher
+ R. Palmer, fix by Sebastian Wilhelmi)
+
Mon Nov 4 14:45:24 2002 Owen Taylor <otaylor@redhat.com>
* gthread-posix.c gthread-solaris.c: Include <config.h>
diff --git a/gthread/gthread-win32.c b/gthread/gthread-win32.c
index 18681ada2..358ba6eb3 100644
--- a/gthread/gthread-win32.c
+++ b/gthread/gthread-win32.c
@@ -291,10 +291,20 @@ g_cond_timed_wait_win32_impl (GCond *cond,
g_return_val_if_fail (cond != NULL, FALSE);
g_return_val_if_fail (entered_mutex != NULL, FALSE);
- g_get_current_time (&current_time);
- to_wait = (abs_time->tv_sec - current_time.tv_sec) * 1000 +
- (abs_time->tv_usec - current_time.tv_usec) / 1000;
-
+ if (!abs_time)
+ to_wait = INFINITE;
+ else
+ {
+ g_get_current_time (&current_time);
+ if (abs_time->tv_sec < current_time.tv_sec ||
+ (abs_time->tv_sec == current_time.tv_sec &&
+ abs_time->tv_usec <= current_time.tv_usec))
+ to_wait = 0;
+ else
+ to_wait = (abs_time->tv_sec - current_time.tv_sec) * 1000 +
+ (abs_time->tv_usec - current_time.tv_usec) / 1000;
+ }
+
return g_cond_wait_internal (cond, entered_mutex, to_wait);
}