[zeromq-dev] Question about context and/or socket creation
James Chapman
james at linux-101.org
Tue Oct 4 18:36:36 CEST 2016
I suspect there is a bug within ZMQ, that or I'm doing something stupid.
Actually, the latter is probably more likely as I'd like to think that this
would have surfaced elsewhere if it was a bug. Attached is minimal test
program which reproduces the issue on my system. In my test, ZMQ is
statically linked to the test program. This is a Windows program compiled
in Visual Studio 2015. Once running, after roughly 2 mins 40 seconds it
crashes. There's an error message that says "abort() has been called".
Could someone please confirm that they also see the crash, and if I am
doing something stupid please feel free to tell me.
James
On 30 September 2016 at 11:49, James Chapman <james at linux-101.org> wrote:
> Thanks, I'll move to a shared context that persists for the duration of
> the process.
>
> Sockets are one per thread, in fact, as the threads are re-used, each
> thread will create many sockets over its lifetime.
>
> -James
>
>
>
> On 30 September 2016 at 11:24, Luca Boccassi <luca.boccassi at gmail.com>
> wrote:
>
>> You can (and probably should as best practise) reuse the context,
>> which is thread safe.
>>
>> Do not use the same socket from multiple threads. There is a new
>> category of thread-safe sockets in libzmq master but the API is not
>> yet finalised.
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20161004/8f842f3f/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.cpp
Type: text/x-c++src
Size: 5162 bytes
Desc: not available
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20161004/8f842f3f/attachment.cpp>
More information about the zeromq-dev
mailing list