mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-19 05:39:18 +02:00
Reset the current parameters in child threads.
This is simple and fast. Inheriting all threads causes immediate problems with exception handlers, and in general should use copy-on-write behavior so that child threads can't affect parents. If we make an eager copy of the parameters we can filter out just the exception handler, but then thread creation is expensive. The ideal design might allow selectively enabling parameter inheritance.
This commit is contained in:
parent
a12df113c5
commit
b10cb94e17
1 changed files with 7 additions and 0 deletions
|
@ -98,6 +98,13 @@ sexp sexp_make_thread (sexp ctx, sexp self, sexp_sint_t n, sexp thunk, sexp name
|
||||||
sexp_context_last_fp(res) = 0;
|
sexp_context_last_fp(res) = 0;
|
||||||
sexp_context_dk(res) = sexp_make_vector(res, SEXP_FOUR, SEXP_FALSE);
|
sexp_context_dk(res) = sexp_make_vector(res, SEXP_FOUR, SEXP_FALSE);
|
||||||
sexp_vector_set(sexp_context_dk(res), SEXP_ZERO, SEXP_ZERO);
|
sexp_vector_set(sexp_context_dk(res), SEXP_ZERO, SEXP_ZERO);
|
||||||
|
/* reset parameters */
|
||||||
|
sexp_context_params(res) = SEXP_NULL;
|
||||||
|
/* alternately reset only the current exception handler */
|
||||||
|
/* for (ls1=sexp_context_params(ctx), ls2=SEXP_NULL; sexp_pairp(ls1); ls1=sexp_cdr(ls1)) */
|
||||||
|
/* if (sexp_caar(ls1) != sexp_global(ctx, SEXP_G_ERR_HANDLER)) */
|
||||||
|
/* ls2 = sexp_cons(ctx, sexp_car(ls1), ls2); */
|
||||||
|
/* sexp_context_params(res) = ls2; */
|
||||||
sexp_gc_release1(ctx);
|
sexp_gc_release1(ctx);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue