1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-16 08:40:19 +02:00

Update the thread stack base when `scm_with_guile' is invoked multiple times.

* NEWS: Update.

* libguile/threads.c (scm_i_init_thread_for_guile): When the thread is
  already guilified, update `t->base' so that it corresponds to the new
  stack base.  Bug report and patch by Linas Vepstas <linasvepstas@gmail.com>.

* test-suite/standalone/Makefile.am (test_scm_with_guile_CFLAGS,
  test_scm_with_guile_LDADD): New.
  (check_PROGRAMS, TESTS): Add `test-scm-with-guile'.
This commit is contained in:
Ludovic Courtès 2008-11-14 00:35:32 +01:00
parent b578508acd
commit cd1a1e47b5
5 changed files with 88 additions and 5 deletions

View file

@ -593,10 +593,19 @@ scm_i_init_thread_for_guile (SCM_STACKITEM *base, SCM parent)
{
/* This thread is already guilified but not in guile mode, just
resume it.
XXX - base might be lower than when this thread was first
guilified.
*/
A user call to scm_with_guile() will lead us to here. This could
happen from anywhere on the stack, and in particular lower on the
stack than when it was when this thread was first guilified. Thus,
`base' must be updated. */
#if SCM_STACK_GROWS_UP
if (base < t->base)
t->base = base;
#else
if (base > t->base)
t->base = base;
#endif
scm_enter_guile ((scm_t_guile_ticket) t);
return 1;
}