-
Notifications
You must be signed in to change notification settings - Fork 396
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
Question about the coordinator in sources and why it causes segfault #579
Comments
from my observation, the following case will also fail: std::vector<int> data{1, 2, 3, 4, 5};
schedulers::run_loop rl;
identity_one_worker c(schedulers::make_run_loop(rl));
sources::iterate(data, c)
.tap([](auto _) {std::cout << "before delay\n";})
.delay(std::chrono::milliseconds(500))
.tap([](auto _) {std::cout << "after delay\n";})
.subscribe([](int v) {
std::cout << "Next " << v << "\n";
}); |
I started investigating this issue. I found that the crash was caused by the following line. RxCpp/Rx/v2/src/rxcpp/rx-scheduler.hpp Line 349 in 761b932
For some reason, the |
One possibility is that the sources (like RxCpp/Rx/v2/src/rxcpp/sources/rx-iterate.hpp Line 277 in 761b932
This makes more sense to me as emitting values does not sounds like asynchronous operation (except interval ). Passing the runloop coordinator seems not a good choice but why will it crash?
|
Can you add the stack for the crash? |
@kirkshoop Sorry for the late response. Here is the stack: (I am using master branch of rxcpp)
|
I have the following code that crashes. It is a RX subscription that is supposed to iterate
data
sequentially (Here it is not substantial but if I introduce delay afterjust
it will be the case).I understand how a scheduler (coordinator) works for a deferred operation (like delay) but I don't know what is the point to supply the coordinator to the sources (such as
just
oriterate
). I simply put the same coordinator to every rx function that takes the coordinator but in this case apparently it fails. I found that if I remove the coordinator injust
it will run correctly.I wonder why shouldn't I use the coordinator in this case and when should I use it?
The text was updated successfully, but these errors were encountered: