Reputation: 689
I have an RX code which is similar to the following:
static ISubject<Unit> m_events = new Subject<Unit>();
private static EventLoopScheduler m_scheduler;
static void Main(string[] args)
{
m_scheduler = new EventLoopScheduler();
m_events.ObserveOn(m_scheduler).Subscribe(onEvent);
foo();
}
static void onEvent(Unit p)
{
// do something
}
static void foo()
{
while (true)
{
m_events.OnNext(Unit.Default);
Thread.Sleep(10);
}
}
Once in a few days the program stops entering onEvent method, and never recovers. (even so the OnNext call keeps happening).
No dispose was called to the subscription.
I use rx-experimental 1.11111.
What could cause this?
Upvotes: 0
Views: 76
Reputation: 211
Can you check using Rx v2.0 RC? We've solved a number of issues in EventLoopScheduler and ObserveOn.
Upvotes: 1
Reputation: 84824
If OnComplete
or OnError
are raised, future OnNext
values will be ignored.
As a side note, am I correct assuming your actual loop code does something more relevant that fire values on an interval? Otherwise you could simply use Observable.Interval
Upvotes: 1
Reputation: 3464
One possibility is that OnException
is called, once this happens, the subscription ends.
Upvotes: 1