You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
or wait for the actor to respond (which AFAIK is the same)
actor=MyActor.spawn(name: 'actor')actor << :dostuffactor.ask(:some_result).value# or actor.ask!(:some_result)
but both are not what I'm looking for. I want to know how to block until an actor is terminated when the actor has asynchronous execution itself:
classMyActor < Concurrent::Actor::Contextdefon_message(message)casemessagewhen:startpromises=10.times.mapdo |n|
Concurrent::Promises.futuredosleep1nendendConcurrent::Promises.zip(*promises).thendoself.tell:terminate!endConcurrent::Actor::Behaviour::MESSAGE_PROCESSEDelsepassendendendmy_actor=MyActor.spawn(name: 'actor')my_actor.tell(:start)# How to do this, as this is obviously not great:loopdobreakifmy_actor.ask!(:terminated?)end
The text was updated successfully, but these errors were encountered:
Is there an easy way to wait for an Actor to terminate? I'm aware that I can wait till all messages are processed:
or wait for the actor to respond (which AFAIK is the same)
but both are not what I'm looking for. I want to know how to block until an actor is terminated when the actor has asynchronous execution itself:
The text was updated successfully, but these errors were encountered: