Skip to content

Commit

Permalink
Ensure no thruption is delivered until restarts are available.
Browse files Browse the repository at this point in the history
Borrow appropriate check from David Lichteblau's commit in mainline.

* src/compiler/generic/parms.lisp (*common-static-symbols*): added *restart-clusters*
* src/runtime/thread.c (create_thread_struct): bind *restart-clusters*
(thread_may_interrupt): check *restart-clusters*
  • Loading branch information
akovalenko committed Dec 3, 2012
1 parent ac12a95 commit 78b43e6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/compiler/generic/parms.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
sb!unix::*allow-with-interrupts*
sb!unix::*interrupts-enabled*
sb!unix::*interrupt-pending*
#!+sb-thruption sb!impl::*restart-clusters*
*in-without-gcing*
*gc-inhibit*
*gc-pending*
Expand Down
9 changes: 9 additions & 0 deletions src/runtime/thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -875,6 +875,7 @@ create_thread_struct(lispobj initial_function) {
#if defined(LISP_FEATURE_WIN32) && defined(LISP_FEATURE_SB_THREAD)
bind_variable(GC_SAFE,NIL,th);
bind_variable(IN_SAFEPOINT,NIL,th);
bind_variable(RESTART_CLUSTERS,NIL,th);
bind_variable(DISABLE_SAFEPOINTS,NIL,th);
#endif

Expand Down Expand Up @@ -1068,6 +1069,14 @@ static inline int thread_may_interrupt()
// 2) INTERRUPTS_ENABLED is not-nil
// 3) !pseudo_atomic (now guaranteed by safepoint-related callers)

// borrowed from David Lichteblau's commit in main branch
if (SymbolValue(RESTART_CLUSTERS, self) == NIL)
/* This special case prevents TERMINATE-THREAD from hitting
* during INITIAL-THREAD-FUNCTION before it's ready. Curiously,
* deferrables are already unblocked there. Further
* investigation may be in order. */
return 0;

if (SymbolValue(INTERRUPTS_ENABLED, self) == NIL)
return 0;

Expand Down

0 comments on commit 78b43e6

Please sign in to comment.