mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-19 05:39:18 +02:00
thread-terminate doesn't set an exception if the thread has already terminated successfully
This commit is contained in:
parent
429704a5f6
commit
0737094107
1 changed files with 7 additions and 5 deletions
|
@ -142,11 +142,13 @@ sexp sexp_thread_terminate (sexp ctx, sexp self, sexp_sint_t n, sexp thread) {
|
|||
/* terminate the thread and all children */
|
||||
for ( ; thread && sexp_contextp(thread); thread=sexp_context_child(thread)) {
|
||||
/* if not already terminated set an exception status */
|
||||
sexp_context_errorp(thread) = 1;
|
||||
sexp_context_result(thread) =
|
||||
sexp_global(ctx, SEXP_G_THREAD_TERMINATE_ERROR);
|
||||
/* zero the refuel - this tells the scheduler the thread is terminated */
|
||||
sexp_context_refuel(thread) = 0;
|
||||
if (sexp_context_refuel(ctx) > 0) {
|
||||
sexp_context_errorp(thread) = 1;
|
||||
sexp_context_result(thread) =
|
||||
sexp_global(ctx, SEXP_G_THREAD_TERMINATE_ERROR);
|
||||
/* zero the refuel - this tells the scheduler the thread is terminated */
|
||||
sexp_context_refuel(thread) = 0;
|
||||
}
|
||||
/* unblock the thread if needed so it can be scheduled and terminated */
|
||||
if (sexp_delete_list(ctx, SEXP_G_THREADS_PAUSED, thread))
|
||||
sexp_thread_start(ctx, self, 1, thread);
|
||||
|
|
Loading…
Add table
Reference in a new issue