[zeromq-dev] CZMQ question re: use of zpoller
Brett Viren
brett.viren at gmail.com
Tue Apr 21 23:21:47 CEST 2020
Hi,
Johnny Depp <sdusa at hotmail.com> writes:
> [...code...]
This code looks okay to me.
> My problem is this: When I use this code in two separate simple applications, the above code
> works. However, when I move the server into a larger application with multiple threads, it is
> starting to behave randomly: it works in some cases, but it mostly doesn't. The poller does
> detect anything on wait.
This raises a possible flag. Is the PULL (server) socket being used
from different threads? If so, you'll need to constrain its entire
lifetime to a single thread.
Or, if you need thread-safety you may switch to SERVER/CLIENT (draft
sockets).
With your code as shown I think you may need to simply change the socket
types from PUSH/PULL to CLIENT/SERVER to test this (and maybe rebuild
with "draft" sockets if they aren't in your libzmq and libczmq builds
already).
Cheers!
-Brett.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20200421/7be30823/attachment.sig>
More information about the zeromq-dev
mailing list