mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-01 12:20:26 +02:00
allow for spurious wakeups from pthread_cond_wait
* libguile/threads.c (scm_call_with_new_thread, scm_spawn_thread): Allow for spurious wakeups while waiting on cond variables. Should fix bug 10641.
This commit is contained in:
parent
dfd1d3b144
commit
dbab8aaaca
1 changed files with 9 additions and 3 deletions
|
@ -1,5 +1,5 @@
|
||||||
/* Copyright (C) 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2004,
|
/* Copyright (C) 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2004,
|
||||||
* 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
|
* 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013
|
||||||
* Free Software Foundation, Inc.
|
* Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
|
@ -1058,7 +1058,10 @@ SCM_DEFINE (scm_call_with_new_thread, "call-with-new-thread", 1, 1, 0,
|
||||||
errno = err;
|
errno = err;
|
||||||
scm_syserror (NULL);
|
scm_syserror (NULL);
|
||||||
}
|
}
|
||||||
scm_i_scm_pthread_cond_wait (&data.cond, &data.mutex);
|
|
||||||
|
while (scm_is_false (data.thread))
|
||||||
|
scm_i_scm_pthread_cond_wait (&data.cond, &data.mutex);
|
||||||
|
|
||||||
scm_i_pthread_mutex_unlock (&data.mutex);
|
scm_i_pthread_mutex_unlock (&data.mutex);
|
||||||
|
|
||||||
return data.thread;
|
return data.thread;
|
||||||
|
@ -1135,7 +1138,10 @@ scm_spawn_thread (scm_t_catch_body body, void *body_data,
|
||||||
errno = err;
|
errno = err;
|
||||||
scm_syserror (NULL);
|
scm_syserror (NULL);
|
||||||
}
|
}
|
||||||
scm_i_scm_pthread_cond_wait (&data.cond, &data.mutex);
|
|
||||||
|
while (scm_is_false (data.thread))
|
||||||
|
scm_i_scm_pthread_cond_wait (&data.cond, &data.mutex);
|
||||||
|
|
||||||
scm_i_pthread_mutex_unlock (&data.mutex);
|
scm_i_pthread_mutex_unlock (&data.mutex);
|
||||||
|
|
||||||
assert (SCM_I_IS_THREAD (data.thread));
|
assert (SCM_I_IS_THREAD (data.thread));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue