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
I needed to create an actor that will set the task in the scheduler before launch. I used actor {} but then I rewrote it with actorOf2. After that I found its behavior very strange.
actorOf2 didn't perform calculations until receiving any message. But in my case. the actor had to recieve messages only from the Scheduler. It is deadlock.
"Minimal, Complete, and Verifiable example":
openAkklingletsystem= System.create "my-system"<| Configuration.defaultConfig()letbuilder()=
props <|fun context ->let recloop()= actor {let!message= context.Receive()
message |> printfn "Message : %i"return! loop ()}
printfn "builder"// In my case: context.Schedule ...
loop ()lettypedActorOf2()=
actorOf2 <|fun cotnext ->let recloop message =
message |> printfn "Message : %i"
loop |> become
printfn "typed actorOf2"// In my case: context.Schedule ...
loop
|> props
letuntypedActorOf2():Props<obj>=
actorOf2 <|fun context ->let recloop(message :obj)=
message
|> tryUnbox
|> Option.iter (printfn "Message : %i")
loop |> become
printfn "untyped actorOf2"// In my case: context.Schedule ...
loop
|> props
If we try to run the following code, we will see that typedActorOf2 () |> spawnAnonymous system doesn't work (typed actorOf2).
builder ()|> spawnAnonymous system
typedActorOf2 ()|> spawnAnonymous system
untypedActorOf2 ()|> spawnAnonymous system
()
>
builder
untyped actorOf2
val it : unit = ()
But if we try to send message after creating, it will work.
builder ()|> spawnAnonymous system <!1
typedActorOf2 ()|> spawnAnonymous system <!1
untypedActorOf2 ()|> spawnAnonymous system |> retype <!1()
>
builder
Message : 1
typed actorOf2
Message : 1
untyped actorOf2
Message : 1
val it : unit = ()
actorOf doesn't have such problems. I want to note that I needed to use context in my challenge.
I suppose boxed actor works because of sending PreStart.
I don't know if this a bug, but I think typed and untyped actors should work the same way regardless of 'Message.
I needed to create an actor that will set the task in the scheduler before launch. I used
actor {}
but then I rewrote it withactorOf2
. After that I found its behavior very strange.actorOf2
didn't perform calculations until receiving any message. But in my case. the actor had to recieve messages only from theScheduler
. It is deadlock."Minimal, Complete, and Verifiable example":
If we try to run the following code, we will see that
typedActorOf2 () |> spawnAnonymous system
doesn't work (typed actorOf2
).But if we try to send message after creating, it will work.
actorOf
doesn't have such problems. I want to note that I needed to usecontext
in my challenge.I suppose boxed actor works because of sending
PreStart
.I don't know if this a bug, but I think
typed
anduntyped
actors should work the same way regardless of'Message
.RUS (little more info)
The text was updated successfully, but these errors were encountered: