Fwd: Timeout function for Thread.Queue->read
Trilok Tourani <[email protected]>
| Newsgroups | gmane.comp.lang.pike.user |
|---|---|
| Message-ID | <CA+9+xUaK9LSjTstWWJP+Q54vBG2hmVJVS0Mu3XmdHHjhL70Hcg@mail.gmail.com> |
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
>>
>