Open ksavelev opened 8 years ago
Running code below;
var consumer = new Consumer(...); // initialize consumer Task.Factory.StartNew(() => { Console.WriteLine("Consumer started"); foreach (var m in bc.Consume()) Console.WriteLine(Encoding.UTF8.GetString(m.Value)); Console.WriteLine("Consumer finished"); }); // wait a sec; consumer.Dispose();
will never print Consumer finished even though consumer is in unusable state and bc.Consume() will never yield any result anymore.
Consumer finished
bc.Consume()
Is it possible to change behavior of Consumer on Dispose so it will release the thread that runs the .Consume() method?
Running code below;
will never print
Consumer finished
even though consumer is in unusable state andbc.Consume()
will never yield any result anymore.Is it possible to change behavior of Consumer on Dispose so it will release the thread that runs the .Consume() method?