Monitoring.

This commit is contained in:
Tony Garnock-Jones 2012-06-19 11:37:01 -04:00
parent d656694eb1
commit 218c6cc561
1 changed files with 21 additions and 0 deletions

21
os2.rkt
View File

@ -55,6 +55,9 @@
(rename-out [yield <yield>])
(rename-out [at-meta-level <at-meta-level>])
(struct-out monitor)
spawn/monitor
;; Reexports from unify.rkt for convenience
wild
wild?
@ -277,6 +280,24 @@
(or (topic-virtual? local-topic)
(not (topic-virtual? remote-topic))))
;;---------------------------------------------------------------------------
;; Monitoring.
(struct monitor (pid debug-name) #:prefab)
(define (spawn/monitor main [k #f] #:debug-name [debug-name #f])
;; TODO: revisit the idea of points-of-attachment. There's an
;; intermediate network between the processes and the kernel, and
;; pid-level presence could be seen as object-level presence on that
;; network somehow.
(define ((monitor-transition main-fn) self-pid)
(define m (monitor self-pid debug-name))
(prefix-transition (main-fn self-pid)
(role (list 'canary m) (topic-publisher m) #:state state)))
(make-spawn (monitor-transition (if (procedure? main) main (lambda (self-pid) main)))
k
#:debug-name debug-name))
;;---------------------------------------------------------------------------
;; Core virtualizable virtual machine.