Skip to content
Browse files

Added (declare (block)) to termite.scm, fixing serialization of some …

…closures

when termite is compiled.
  • Loading branch information...
1 parent e8875b8 commit a8dd564387fce6d9c2d0dba6c975daf67181bdcb @yome yome committed May 8, 2009
Showing with 41 additions and 38 deletions.
  1. +1 −1 VERSION
  2. +40 −37 termite.scm
View
2 VERSION
@@ -1 +1 @@
-0.13
+0.14
View
77 termite.scm
@@ -1,4 +1,4 @@
-;; Copyright (C) 2005-2008 by Guillaume Germain, All Rights Reserved.
+;; Copyright (C) 2005-2009 by Guillaume Germain, All Rights Reserved.
;; File: "termite.scm"
;; this is the main file for the Termite system
@@ -7,11 +7,14 @@
(##include "~~/lib/gambit#.scm")
(##include "termite#.scm")
+(declare
+ (standard-bindings)
+ (extended-bindings)
+ (block))
+
;; ----------------------------------------------------------------------------
;; System configuration & global data
-(define *termite-cookie* (getenv "TERMITE_COOKIE" #f))
-
(define current-node (lambda () (error "uninitialized node")))
(define *global-mutex* (make-mutex "global termite mutex"))
@@ -81,38 +84,38 @@
;; Base exception handler for Termite processes.
(define (base-exception-handler e)
(continuation-capture
- (lambda (k)
- (let ((log-crash
- (lambda (e)
- (termite-log
- 'error
- (call-with-output-string ""
- (lambda (port)
- (display "#|\n" port)
- (display-exception-in-context
- e
- k
- port)
- ; todo: provide a safe wrapper in Gambit runtime?
- (##cmd-b k port 0)
- (display "|#\n" port)))))))
- (cond
- ;; Propagated Termite exception?
- ((termite-exception? e)
- (if (not (eq? (termite-exception-reason e) 'normal))
- (log-crash (termite-exception-object e)))
- (for-each
- (lambda (pid) (! pid e))
- (process-links (self)))
- (halt!))
- ;; Gambit exception in the current process
- (else
- (log-crash e)
- (for-each
- (lambda (pid)
- (! pid (make-termite-exception (self) 'failure e)))
- (process-links (self)))
- (halt!)))))))
+ (lambda (k)
+ (let ((log-crash
+ (lambda (e)
+ (termite-log
+ 'error
+ (call-with-output-string ""
+ (lambda (port)
+ (display "#|\n" port)
+ (display-exception-in-context
+ e
+ k
+ port)
+ ;; todo: provide a safe wrapper in Gambit runtime?
+ (##cmd-b k port 0)
+ (display "|#\n" port)))))))
+ (cond
+ ;; Propagated Termite exception?
+ ((termite-exception? e)
+ (if (not (eq? (termite-exception-reason e) 'normal))
+ (log-crash (termite-exception-object e)))
+ (for-each
+ (lambda (pid) (! pid e))
+ (process-links (self)))
+ (halt!))
+ ;; Gambit exception in the current process
+ (else
+ (log-crash e)
+ (for-each
+ (lambda (pid)
+ (! pid (make-termite-exception (self) 'failure e)))
+ (process-links (self)))
+ (halt!)))))))
;; * Start a new process executing the code in 'thunk'.
@@ -894,8 +897,8 @@
(msg (debug "ping-server ignored message" msg)))
(loop)))))
-(define (ping node)
- (!? (remote-service 'ping-server node) 'ping 1.0 'no-reply))
+(define (ping node #!optional (timeout 1.0))
+ (!? (remote-service 'ping-server node) 'ping timeout 'no-reply))
;; ----------------------------------------------------------------------------
;; Initialization

0 comments on commit a8dd564

Please sign in to comment.
Something went wrong with that request. Please try again.