Re: Non-blocking read [message #75617] |
Wed, 16 March 2011 08:35 |
wlandsman
Messages: 743 Registered: June 2000
|
Senior Member |
|
|
In case others are wondering, the correct name of the routine is FILE_POLL_INPUT (not FILE_POLL_UNIT as I wrote), and the TIMEOUT value is a keyword not a parameter. --Wayne
|
|
|
Re: Non-blocking read [message #75619 is a reply to message #75617] |
Wed, 16 March 2011 07:33  |
David Grier
Messages: 35 Registered: July 2010
|
Member |
|
|
On 3/15/11 9:49 PM, wlandsman wrote:
> On Tuesday, March 15, 2011 8:22:38 PM UTC-4, David Grier wrote:
>
>> I'm using OPENW, WRITEU and READU to interact with a piece of equipment
>> through a serial port. Everything's fine unless there's an error
>> condition on the read. If the read fails, then the IDL session hangs
>> irretrievably. I'd like to use a non-blocking read so that failure
>> yields no value and some error condition that I can check.
>
> Would it help to use
> if FILE_POLL_UNIT( unit, 0) then readu,...
>
> My IDL session hangs about 1 in a 1000 times when trying to read an internet socket.
> I've tried using the above code snippet, but I don't know yet if it works, because
> I the failures occur so unpredictably. (And once the IDL session does hang, one
> loses any diagnostics.) -Wayne
Brilliant! I never would have found this routine, and it does just what
I need.
Many thanks Wayne.
David
|
|
|
Re: Non-blocking read [message #75622 is a reply to message #75619] |
Tue, 15 March 2011 18:49  |
wlandsman
Messages: 743 Registered: June 2000
|
Senior Member |
|
|
On Tuesday, March 15, 2011 8:22:38 PM UTC-4, David Grier wrote:
> I'm using OPENW, WRITEU and READU to interact with a piece of equipment
> through a serial port. Everything's fine unless there's an error
> condition on the read. If the read fails, then the IDL session hangs
> irretrievably. I'd like to use a non-blocking read so that failure
> yields no value and some error condition that I can check.
Would it help to use
if FILE_POLL_UNIT( unit, 0) then readu,...
My IDL session hangs about 1 in a 1000 times when trying to read an internet socket. I've tried using the above code snippet, but I don't know yet if it works, because I the failures occur so unpredictably. (And once the IDL session does hang, one loses any diagnostics.) -Wayne
|
|
|