This allows actors which may call out long procedures, such as a web
worker, to still be able to have access their actor so they can send
messages to other actors.
* 8sync/systems/actors.scm (%current-actor): New variable.
(hive-process-message): Update to parameterize %current-actor.
actor-id
actor-message-handler
actor-id
actor-message-handler
;;; Commenting out the <address> type for now;
;;; it may be back when we have better serializers
;; <address>
;;; Commenting out the <address> type for now;
;;; it may be back when we have better serializers
;; <address>
"Render the full actor id as a human-readable string"
(address->string (actor-id actor)))
"Render the full actor id as a human-readable string"
(address->string (actor-id actor)))
+(define %current-actor
+ (make-parameter #f))
(lambda ()
(define message-handler (actor-message-handler actor))
;; @@: Should a more general error handling happen here?
(lambda ()
(define message-handler (actor-message-handler actor))
;; @@: Should a more general error handling happen here?
- (let ((result
- (message-handler actor message)))
- (maybe-autoreply actor)
- ;; Returning result allows actors to possibly make a run-request
- ;; at the end of handling a message.
- ;; ... We do want that, right?
- result)))))
+ (parameterize ((%current-actor actor))
+ (let ((result
+ (message-handler actor message)))
+ (maybe-autoreply actor)
+ ;; Returning result allows actors to possibly make a run-request
+ ;; at the end of handling a message.
+ ;; ... We do want that, right?
+ result))))))
(define (resume-waiting-coroutine)
(cond
(define (resume-waiting-coroutine)
(cond