[zeromq-dev] non blocking receive and api_thread_poll_rate

Pavel Gushcha pavimus at gmail.com
Wed Jul 29 13:37:30 CEST 2009


---------- Пересланное сообщение ----------
От: Павел Гуща <pavimus at gmail.com>
Дата: 28 июля 2009 г. 22:44
Тема: Re: [zeromq-dev] non blocking receive and api_thread_poll_rate
Кому: Martin Hurton <hurtonm at gmail.com>


Thanks, Martin. First i tried trunk without patch- problem exists. After
patch applying problem disappears, your patch works! Will be it included in
next 0MQ release?

2009/7/28 Martin Hurton <hurtonm at gmail.com>

Hi Pavel,
>
> I have prepared a small patch (see attached file). Could you please apply
> it to the trunk and let us know if it solves the delay issue?
>
> - Martin
>
> On Tue, Jul 28, 2009 at 1:41 AM, Павел Гуща<pavimus at gmail.com> wrote:
> > I have multithreaded application, powered by 0MQ. One of threads has
> > following algorithm:
> >
> > while (true) {
> >    sleep one second;
> >    int queue_id=api_thread->receive(my_message,false); // use non
> blocking
> > receive()
> >    if (queue_id!=0) break; // break loop, if message was received.
> > }
> >
> > All works, but... time between sending message from another thread and
> > breaking loop in this thread is above minute! I looked at zeromq sources
> and
> > see following code in receive function:
> >
> >     if (++ ticks == api_thread_poll_rate) {
> >         ypollset_t::integer_t signals = pollset.check ();
> >         if (signals)
> >             process_commands (signals);
> >         ticks = 0;
> >     }
> >
> > additionally i found, that api_thread_poll_rate is equal to 100. So, time
> > between calls of process_commands() for my case (because of sleep) is
> about
> > 100 seconds.
> >
> > After that, i tried to call "api_thread->flush()" before
> > "api_thread->receive()" and this big delay between message sending and
> > receiving disappears! This is because flush() function explicitly call
> > process_command().
> >
> > How i can solve this problem in more elegant way than calling flush() ?
> >
> >
> >
> > _______________________________________________
> > 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/20090729/d36f59e9/attachment.htm>


More information about the zeromq-dev mailing list