[zeromq-dev] Syncronising / isolating zsys layer between dlls

Osiris Pedroso opedroso at gmail.com
Thu Jan 18 13:54:36 CET 2018


The count you keep, where does it live?
Seems like it should live in the main executable or another DLL that
outlives both origin.dll and client.dll.
That way the count would be shared and only after both DLLs stop using
zsys, zsys_shutdown would be called.
Also make sure count is updated with InterlockedIncrement and
InterlockedDecrement APIs so there are no race conditions.

Don't know if an option, but have you considered using static library links
of the zsys code?

On Jan 18, 2018 06:09, "Stephen Gray" <riskybizlive at live.com> wrote:

> I’ve got two dlls;  origin.dll & client.dll, both use the CZMQ api are
> running on the same Windows computer as my custom extensions to a
> proprietary app.
>
>
>
> I’m having issues with the scoping of zsys.  I think there is one instance
> of zsys layer serving both dlls.  But my understanding of how zsys layer
> works is hazy.
>
>
>
> Inside each dll at runtime are multiple instances of a class using the
> CZMQ api.  I call zsys_init() on instantiation of the first class then I
> keep count of the instances as they come and go.  When the count goes to
> zero I call zsys_shutdown().  This causes an issue when, for example,
> client.dll is shutting down but origin.dll is still running.  The client
> shuts down the zsys layer which pulls the rug from under origin.dll then
> everything gets untidy, inelegant and crashes.
>
>
>
> Is there a way to give each dll a dedicated zsys layer?  Or a way to
> synchronise the shutdown? Or some other way to solve the problem?
>
>
>
> This is the final issue in getting my scheme to function!  So close……
>
>
>
> Thanks,
>
>
>
> Stephen
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> https://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20180118/624ea18f/attachment.htm>


More information about the zeromq-dev mailing list