+ ;; These are called at start and end of run-hive
+ (*init-all* hive-handle-init-all)
+ (*cleanup-all* hive-handle-cleanup-all))))
+
+(define-method (hive-handle-init-all (hive <hive>) message)
+ "Run *init* method on all actors in registry"
+ ;; We have to do this hack and run over the list
+ ;; twice, because hash-for-each would result in an unrewindable
+ ;; continuation, and to avoid the hash-map changing during the
+ ;; middle of this.
+ (define actor-ids
+ (hash-map->list (lambda (actor-id actor) actor-id)
+ (hive-actor-registry hive)))
+ (for-each (lambda (actor-id)
+ (let* ((actor (hash-ref (hive-actor-registry hive)
+ actor-id)))
+ (match (slot-ref actor 'should-init)
+ (#f #f)
+ ('wait
+ (<-wait actor-id '*init*))
+ (_
+ (<- actor-id '*init*)))))
+ actor-ids))