Open darkdragon-001 opened 2 years ago
@pebbe Could you have a look?
The intention is not to be pessimistic, but wouldn't this work better as a utility library instead of built into the pebbe/zmq4? No one wants to use Socket
non-thread safe (because it leads to nasty bugs) so then we should re-design the current socket if thread-safety is the goal instead of providing an alternative use case.
@doctordesh Adding thread safety to such an interface would probably mean synchronizing all over the place (mutex, semaphore, ...) which I imagine to degrade the speed. That's why go invented channels in order to combine thread safety and speed at the same time. The ZMQ C sockets are not meant to be used from multiple threads at the same time.
The advantage of having this in pebbe/zmq4
instead of being a separate library is that it is being made sure that it stays compatible when interfaces change.
In order to use zmq the go way, this PR adds a thread safe channel interface provided by abligh/zmqchan. Permission is granted by the author in abligh/zmqchan#1.