[zeromq-dev] CZMQ and Server and Client Sockets

Doron Somech somdoron at gmail.com
Mon Aug 17 17:29:40 CEST 2015


So my best version right now is to leave zmq_poll as was before the change,
to poll on thread safe sockets pollfd api must be used.
However the migrate to pollfd api should be pretty simple, as the polling
method signature is:

int zmq_pollfd_poll (void *p, zmq_pollitem_t *items, int nitems, long
timeout);

The method support both thread safe and regular sockets.

Right now the implementation is duplication of zmq_poll with some changes
to support pollfd, in the future once the pollfd will be stable we can
remove the redundant code.

You can take a look here:

https://github.com/somdoron/libzmq/commit/309c8d9a40b47de66541637638cad1ac1836d657

I also think that it would be smart to move zpoller from czmq to zeromq as
this is repeating in every binding implementation and the code is not
simple to implement. If it was part of zeromq making the polling on thread
safe sockets would become much easier and compatible without api changes.



On Mon, Aug 17, 2015 at 4:43 PM, Doron Somech <somdoron at gmail.com> wrote:

> wIt is not level triggered by himself, only together with zmq_poll. pollfd
> is like socket fd which is edge.
>
> However we can still do it, it will be a little complicate. We need to
> reset the pollfd immediately after calling zmq_poll. This will be edge
> triggered, to make it level we have to check all events before calling
> zmq_poll again.
>
> we can have a method that do this, so binding can implement manually or
> use something like:
>
> zmq_pollfd_poll (void *p, zmq_poll_item *items, int *nitems, long
> timeout);
>
>
> On Mon, Aug 17, 2015 at 4:16 PM, KIU Shueng Chuan <nixchuan at gmail.com>
> wrote:
>
>> If the pollfd is level triggered, then we could just use the system
>> poll/select directly. Then check all thread safe zsocks attached to the
>> pollfd for ZMQ_EVENTS.
>>
>> It would thus be trivial to use thread safe zsocks with other event
>> loops. If pollfd is level triggered, that is.
>>
>> _______________________________________________
>> zeromq-dev mailing list
>> zeromq-dev at lists.zeromq.org
>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20150817/710a5076/attachment.htm>


More information about the zeromq-dev mailing list