X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=8sync%2Factors.scm;h=8f1538cd5c6b48c7374ec89a36b050079f038a72;hb=38afa0b278e17953b64764d800beaaa6368f70be;hp=bb4d342a8ff0f49ba5f78ff64c60c52076be767b;hpb=c08fc1bf81e422ead4e3394e711ce8d0724559ae;p=8sync.git diff --git a/8sync/actors.scm b/8sync/actors.scm index bb4d342..8f1538c 100644 --- a/8sync/actors.scm +++ b/8sync/actors.scm @@ -86,7 +86,9 @@ ;; Maybe the wrong place for this, or for it to be exported. ;; But it's used in websockets' server implementation at least... - live-wrap)) + live-wrap + + *debug-actor-ids*)) ;; For ids (set! *random-state* (random-state-from-platform)) @@ -652,14 +654,22 @@ to spawn-hive... all remaining arguments passed to run-fibers." ;; return the address address)) +;;; Whether or not to attach the class' name as a cookie by default in +;;; create-actor +(define *debug-actor-ids* + (make-parameter #t)) + (define* (create-actor actor-class #:rest init-args) "Create an instance of actor-class. Return the new actor's id. This is the method actors should call directly (unless they want to supply an id-cookie, in which case they should use create-actor*)." - (%create-actor actor-class init-args #f #t)) - + (%create-actor actor-class init-args + (if (*debug-actor-ids*) + (symbol->string (class-name actor-class)) + #f) + #t)) (define* (create-actor* actor-class id-cookie #:rest init-args) "Create an instance of actor-class. Return the new actor's id. @@ -667,11 +677,10 @@ create-actor*)." Like create-actor, but permits supplying an id-cookie." (%create-actor actor-class init-args id-cookie #t)) -(define* (self-destruct actor #:key (cleanup #t)) +(define (self-destruct actor) "Remove an actor from the hive. -Unless #:cleanup is set to #f, this will first have the actor handle -its '*cleanup* action handler." +The actor will also call its `actor-cleanup!' method." (signal-condition! (address-dead? (actor-id actor))) (put-message (*hive-channel*) (list 'remove-actor (actor-id-actor actor))) ;; Set *actor-prompt* to nothing to prevent actor-cleanup! from sending