[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 16/17: REPL server avoids thread cleanup handlers
From: |
Andy Wingo |
Subject: |
[Guile-commits] 16/17: REPL server avoids thread cleanup handlers |
Date: |
Mon, 31 Oct 2016 21:39:38 +0000 (UTC) |
wingo pushed a commit to branch master
in repository guile.
commit 94a3433b9d1da4acf2737aa1db8ce129b90623d9
Author: Andy Wingo <address@hidden>
Date: Mon Oct 31 22:13:30 2016 +0100
REPL server avoids thread cleanup handlers
* module/system/repl/server.scm (serve-client): Avoid thread cleanup
handlers.
---
module/system/repl/server.scm | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
diff --git a/module/system/repl/server.scm b/module/system/repl/server.scm
index b1b8a6b..f6981ed 100644
--- a/module/system/repl/server.scm
+++ b/module/system/repl/server.scm
@@ -133,16 +133,17 @@
(define (serve-client client addr)
(let ((thread (current-thread)))
- ;; Close the socket when this thread exits, even if canceled.
- (set-thread-cleanup! thread (lambda () (close-socket! client)))
- ;; Arrange to cancel this thread to forcefully shut down the socket.
+ ;; To shut down this thread and socket, cause it to unwind.
(add-open-socket! client (lambda () (cancel-thread thread))))
- (with-continuation-barrier
- (lambda ()
- (parameterize ((current-input-port client)
- (current-output-port client)
- (current-error-port client)
- (current-warning-port client))
- (with-fluids ((*repl-stack* '()))
- (start-repl))))))
+ (dynamic-wind
+ (lambda () #f)
+ (with-continuation-barrier
+ (lambda ()
+ (parameterize ((current-input-port client)
+ (current-output-port client)
+ (current-error-port client)
+ (current-warning-port client))
+ (with-fluids ((*repl-stack* '()))
+ (start-repl)))))
+ (lambda () (close-socket! client))))
- [Guile-commits] 11/17: Rationalize exception handling in srfi-18, (continued)
- [Guile-commits] 11/17: Rationalize exception handling in srfi-18, Andy Wingo, 2016/10/31
- [Guile-commits] 17/17: Remove thread cleanup facility, Andy Wingo, 2016/10/31
- [Guile-commits] 02/17: Fix srfi-34 indentation, Andy Wingo, 2016/10/31
- [Guile-commits] 12/17: Refactor thread-join! to use optional args., Andy Wingo, 2016/10/31
- [Guile-commits] 13/17: Trim srfi-18 thread startup machinery, Andy Wingo, 2016/10/31
- [Guile-commits] 14/17: cancel-thread can take arguments, Andy Wingo, 2016/10/31
- [Guile-commits] 03/17: srfi-18: Improve style., Andy Wingo, 2016/10/31
- [Guile-commits] 15/17: srfi-18: thread-terminate! without cleanup handlers, Andy Wingo, 2016/10/31
- [Guile-commits] 01/17: cancel-thread via asyncs, not pthread_cancel, Andy Wingo, 2016/10/31
- [Guile-commits] 08/17: srfi-18: Use srfi-35 conditions., Andy Wingo, 2016/10/31
- [Guile-commits] 16/17: REPL server avoids thread cleanup handlers,
Andy Wingo <=
- [Guile-commits] 09/17: srfi-18: Inline uses of srfi-18-exception-preserver., Andy Wingo, 2016/10/31