Re: Timeout function for Thread.Queue->read

Marc dirix <[email protected]>
Newsgroups gmane.comp.lang.pike.user
Message-ID <CAERi-x3mk2EgYBGs8=3d7KXye3mE8cfVTYs2aiGv1atMN2Jmtg@mail.gmail.com>
Please keep the discussion on-list.
If you would change it to a callback based application no synchronisation
is needed.

Otherwise, a sleep statement would reduce the amount of try_read()s, but is
still not very efficient.

/Marc

Op ma 29 jun. 2015 om 17:00 schreef Trilok Tourani <
[email protected]>:

> Hello Marc
>
> I have tried that already, I have to keep a while loop something like
> while(result->try_read()){ .... } . This runs for like 50-60 times before
> it provides a non zero value. I think that's very inefficient. And this
> read statement runs for like 200 iterations. Every iteration running 50-60
> times. That will result in a lot of delay for my result.
>
> Please give me a example if you can avoid this kind of problem.
>
>
> Regards
> Trilok Tourani
>
> On Mon, Jun 29, 2015 at 3:04 PM, Marc dirix <[email protected]> wrote:
>
>> Hello,
>>
>> You could use try_read(), and move the timeout logic into the reading
>> thread.
>>
>> /Marc
>>
>> Op ma 29 jun. 2015 om 10:24 schreef Trilok Tourani <
>> [email protected]>:
>>
>>> Hello all
>>>
>>> Is there any pike function for timeout for the Thread.Queue class ,read
>>> function? My program just hangs at that statement because there is nothing
>>> in the Queue, and I have to add a dummy element in queue after the timeout
>>> seconds.(Workaround)
>>>
>>> Please mention any function that can server this purpose.
>>>
>>> Thank you
>>>
>>>
>>> Regards
>>> Trilok Tourani
>>>
>>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.