zeromq / netmq

A 100% native C# implementation of ZeroMQ for .NET
Other
2.94k stars 742 forks source link

Poller RunAsync doesnt work. #1031

Closed emelrad12 closed 1 year ago

emelrad12 commented 1 year ago

Environment

NetMQ Version:    4.0.1.9
Operating System:  Windows 11
.NET Version:     Mono

Expected behaviour

Poller.RunAsync starts, creates thread and works

Actual behaviour

poller.RunAsync does not create thread propertly When debugging there is no thread left from the poller

Replacing it with Task.Run(poller.Run) works as expected. Also running poller.Run by itself also works. Running Task.Run(poller.Run) after poller.RunAsync results in nothing outputted

Steps to reproduce the behaviour

Create publisher socket, then create subcriber Connect them. Start poller.

example code, change the commented line to toggle. socket = new SubscriberSocket(">tcp://localhost:15555"); socket.Subscribe("A"); using (var poller = new NetMQPoller{socket}) { socket.ReceiveReady += Server_ReceiveReady; //poller.RunAsync(); Task.Run(poller.Run); }

dxdjgl commented 1 year ago

Since Dispose will terminate the thread, it is expected that that the thread is not running. So at least your example behaves as expected.