Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

State disposed during inboxFn when asked #46

Open
StefanBertels opened this issue Sep 20, 2018 · 0 comments
Open

State disposed during inboxFn when asked #46

StefanBertels opened this issue Sep 20, 2018 · 0 comments

Comments

@StefanBertels
Copy link
Contributor

Issue similar to #42 but when actor is asked.

Can be reproduced with:

using System.Reactive.Disposables;

var actor2 = spawn<BooleanDisposable, long>("actor2", () => new BooleanDisposable(), (state, msg) =>
                {
                    using (observeUnsafe<Unit>(Self).Subscribe(_ => { }, () => { Console.WriteLine("subject completed in actor2"); }))
                    {
                        Console.WriteLine($"actor2: Processing msg: {msg}, state.IsDisposed={state.IsDisposed}");
                        Task.Delay(5 * seconds).Wait();
                        reply("Answer from actor2");
                        Console.WriteLine($"actor2: Answered and finished processing msg: {msg}, state.IsDisposed={state.IsDisposed}");
                    }


                    return state;
                });

                //ASK
                Observable.Timer(1 * seconds).Subscribe(_ =>
                {
                    Console.WriteLine($"Telling actor2 msg: {_}");
                    var answer = ask<string>(actor2, _);
                    Console.WriteLine($"Answer from actor2: {answer}");
                });

                Observable.Timer(2 * seconds).Subscribe(_ =>
                {
                    Console.WriteLine("Killing actor2...");
                    kill(actor2);
                    Console.WriteLine("Killed actor2...");
                });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant