* threads.c (scm_timed_wait_condition_variable): Support timed
authorMikael Djurfeldt <djurfeldt@nada.kth.se>
Fri, 10 Jan 2003 22:16:56 +0000 (22:16 +0000)
committerMikael Djurfeldt <djurfeldt@nada.kth.se>
Fri, 10 Jan 2003 22:16:56 +0000 (22:16 +0000)
waiting also for simple condition variables.

libguile/ChangeLog
libguile/threads.c

index 37253f3..c6fd067 100644 (file)
@@ -1,5 +1,8 @@
 2003-01-10  Mikael Djurfeldt  <djurfeldt@nada.kth.se>
 
+       * threads.c (scm_timed_wait_condition_variable): Support timed
+       waiting also for simple condition variables.
+
        * goops.c (TEST_CHANGE_CLASS): Use scm_change_object_class instead
        of calling the procedure change-object-class.
 
index fde6663..2534150 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995,1996,1997,1998,2000,2001, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1997,1998,2000,2001, 2002, 2003 Free Software Foundation, Inc.
  * 
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -943,11 +943,16 @@ SCM_DEFINE (scm_timed_wait_condition_variable, "wait-condition-variable", 2, 1,
     {
       scm_t_cond *c = SCM_CONDVAR_DATA (cv);
       scm_t_mutex *m = SCM_MUTEX_DATA (mx);
-      err = scm_cond_wait (c, m);
+      if (SCM_UNBNDP (t))
+       err = scm_cond_wait (c, m);
+      else
+       err = scm_cond_timedwait (c, m, &waittime);
     }
 
   if (err)
     {
+      if (err == ETIMEDOUT)
+       return SCM_BOOL_F;
       errno = err;
       SCM_SYSERROR;
     }