+1998-11-19 Mikael Djurfeldt <mdj@mdj.nada.kth.se>
+
+ * readline.c (scm_init_readline): Set
+ rl_basic_word_break_characters. (Thanks to Ian Grant.)
+
+ * coop.c (coop_condition_variable_wait): Removed
+ (coop_condition_variable_wait_mutex): Folded logic of
+ coop_mutex_unlock into coop_condition_variable_wait_mutex to
+ prevent condvar signal lossage. Previously, another thread could
+ start to run after unlocking the mutex but before putting the
+ current thread on the wait queue. If that thread then would
+ signal the first, the signal would be lost. (Thanks to Christian
+ Lynbech.)
+
1998-11-17 Mikael Djurfeldt <mdj@mdj.nada.kth.se>
* eval.c (SCM_CEVAL): Added missing case for cclo. (Thanks to
* If you do not wish that, delete this exception notice. */
\f
-/* $Id: coop.c,v 1.14 1998-10-13 23:17:09 jimb Exp $ */
+/* $Id: coop.c,v 1.15 1998-11-19 08:15:22 mdj Exp $ */
/* Cooperative thread library, based on QuickThreads */
old = coop_global_curr;
coop_global_curr = newthread;
+ /* The new thread came into m->waiting through a lock operation.
+ It now owns this mutex. */
m->owner = coop_global_curr;
QT_BLOCK (coop_yieldhelp, old, &coop_global_runq, newthread->sp);
}
}
#ifdef __STDC__
-static int
-coop_condition_variable_wait (coop_c *c)
+int
+coop_condition_variable_wait_mutex (coop_c *c, coop_m *m)
#else
-static int
-coop_condition_variable_wait (c)
+int
+coop_condition_variable_wait_mutex (c, m)
coop_c *c;
+ coop_m *m;
#endif
{
coop_t *old, *newthread;
+ /* coop_mutex_unlock (m); */
+ newthread = coop_qget (&(m->waiting));
+ if (newthread != NULL)
+ {
+ m->owner = newthread;
+ }
+ else
+ {
+ m->owner = NULL;
#ifdef GUILE_ISELECT
- newthread = coop_wait_for_runnable_thread();
- if (newthread == coop_global_curr)
- coop_abort ();
+ newthread = coop_wait_for_runnable_thread();
+ if (newthread == coop_global_curr)
+ coop_abort ();
#else
- newthread = coop_next_runnable_thread();
+ newthread = coop_next_runnable_thread();
#endif
+ }
+ coop_global_curr->top = &old;
old = coop_global_curr;
coop_global_curr = newthread;
QT_BLOCK (coop_yieldhelp, old, &(c->waiting), newthread->sp);
- return 0;
-}
-
-#ifdef __STDC__
-int
-coop_condition_variable_wait_mutex (coop_c *c, coop_m *m)
-#else
-int
-coop_condition_variable_wait_mutex (c, m)
- coop_c *c;
- coop_m *m;
-#endif
-{
- coop_mutex_unlock (m);
- coop_condition_variable_wait (c);
coop_mutex_lock (m);
return 0;
}