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
Current Signal implementation use a thread-unsafe LifetimedList as a backend. There are some exception-protecting mechanisms in LifetimedLists, which significantly reduce the probability of exception during Advise/Fire, but they can't protect in all cases. Since it is allowed to use arbitrary schedulers for RdSignal, reliable thread-safe solution is required here.
Sample test to violate existing implementation:
[Test]
public async Task TestSignalStress()
{
var sig = new Signal<bool>();
using (var run = new LifetimeDefinition())
{
var lt = run.Lifetime;
var sw = Stopwatch.StartNew();
var fireTask = Task.Run(() =>
{
while (sw.ElapsedMilliseconds < 500 && lt.IsAlive)
sig.Fire(true);
}, lt);
Parallel.For(0, 100000, i =>
{
using (var ld = new LifetimeDefinition())
sig.Advise(ld.Lifetime, x => { });
});
await fireTask;
}
}
The text was updated successfully, but these errors were encountered:
Current Signal implementation use a thread-unsafe LifetimedList as a backend. There are some exception-protecting mechanisms in LifetimedLists, which significantly reduce the probability of exception during Advise/Fire, but they can't protect in all cases. Since it is allowed to use arbitrary schedulers for RdSignal, reliable thread-safe solution is required here.
Sample test to violate existing implementation:
The text was updated successfully, but these errors were encountered: