X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Ftarget-thread.lisp;h=1d38f088afa7296f26ee7ce701e2f3ae60396eb1;hb=84271f268f29364b57bfeb1b37642311eb8ab910;hp=2390437accf49fa2eb680e64341d9d51aa76f65e;hpb=ce0a49644dce03ca07008e8073897e4ed7b247df;p=sbcl.git diff --git a/src/code/target-thread.lisp b/src/code/target-thread.lisp index 2390437..1d38f08 100644 --- a/src/code/target-thread.lisp +++ b/src/code/target-thread.lisp @@ -389,27 +389,25 @@ interactive." (session-interactive-threads *session*)))) (get-foreground))) -(defun thread-repl-prompt-fun (out-stream) - (get-foreground) - (let ((stopped-threads (cdr (session-interactive-threads *session*)))) - (when stopped-threads - (format out-stream "~{~&Thread ~A suspended~}~%" stopped-threads)) - (sb!impl::repl-prompt-fun out-stream))) (defun get-foreground () - (loop - (with-mutex ((session-lock *session*)) - (let ((tid (current-thread-id)) - (int-t (session-interactive-threads *session*))) - (when (eql (car int-t) tid) - (sb!sys:enable-interrupt sb!unix:sigint #'sb!unix::sigint-handler) - (return-from get-foreground t)) - (unless (member tid int-t) - (setf (cdr (last int-t)) - (list tid))) - (condition-wait - (session-interactive-threads-queue *session*) - (session-lock *session*)))))) + (let ((was-foreground t)) + (loop + (with-mutex ((session-lock *session*)) + (let ((tid (current-thread-id)) + (int-t (session-interactive-threads *session*))) + (when (eql (car int-t) tid) + (unless was-foreground + (format *query-io* "Resuming thread ~A~%" tid)) + (sb!sys:enable-interrupt sb!unix:sigint #'sb!unix::sigint-handler) + (return-from get-foreground t)) + (setf was-foreground nil) + (unless (member tid int-t) + (setf (cdr (last int-t)) + (list tid))) + (condition-wait + (session-interactive-threads-queue *session*) + (session-lock *session*))))))) (defun release-foreground (&optional next) "Background this thread. If NEXT is supplied, arrange for it to have the foreground next"