diff options
author | Xavier Leroy <xavier.leroy@inria.fr> | 1998-04-14 14:47:06 +0000 |
---|---|---|
committer | Xavier Leroy <xavier.leroy@inria.fr> | 1998-04-14 14:47:06 +0000 |
commit | c3bb497dd8079e063ef4ca0477d55a8e8f998064 (patch) | |
tree | 3d95263d4638fabfe779bf2d203547fe5020d0cb | |
parent | 49c266fde7121a352f62b3118d1dc96e7b098735 (diff) |
Nouveau traitement de callback_depth.
Probleme de racines GC dans Thread.kill
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@1918 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r-- | otherlibs/threads/scheduler.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/otherlibs/threads/scheduler.c b/otherlibs/threads/scheduler.c index 98b4c8a56..3135edfc8 100644 --- a/otherlibs/threads/scheduler.c +++ b/otherlibs/threads/scheduler.c @@ -254,7 +254,7 @@ static value schedule_thread(void) int need_select, need_wait; /* Don't allow preemption during a callback */ - if (callback_depth > 0) return curr_thread->retval; + if (callback_depth > 1) return curr_thread->retval; /* Save the status of the current thread */ curr_thread->stack_low = stack_low; @@ -403,7 +403,7 @@ try_again: static void check_callback(void) { - if (callback_depth > 0) + if (callback_depth > 1) fatal_error("Thread: deadlock during callback"); } @@ -547,7 +547,12 @@ value thread_kill(value thread) /* ML */ /* This thread is no longer waiting on anything */ th->status = KILLED; /* If this is the current thread, activate another one */ - if (th == curr_thread) retval = schedule_thread(); + if (th == curr_thread) { + Begin_root(thread); + retval = schedule_thread(); + th = (thread_t) thread; + End_roots(); + } /* Remove thread from the doubly-linked list */ Assign(th->prev->next, th->next); Assign(th->next->prev, th->prev); |