gnokii-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: nonblocking read


From: Pawel Kot
Subject: Re: nonblocking read
Date: Thu, 15 Nov 2007 14:47:57 +0100

On Nov 14, 2007 9:06 PM, Baurzhan Ismagulov <address@hidden> wrote:
> On Tue, Nov 13, 2007 at 12:15:17AM +0100, Pawel Kot wrote:
> > > > > > gnokii uses:
> > > > > > if (select(...) > 0)
> > > > > >   read(...);
> > > > > > sequence to read from the file descriptor.  In case of bluetooth
> > > > > > connection there may happen that gnokii/xgnokii/whatever is running
> > > > > > and sending requests and then suddenly gets out of range. So what
> > > > > > happenes there is that select() returns 1 and read() hands.
> > > > >
> > > > > IIUC, this should not happen.
> ...
> > I disagree. Look at the following scenario:
> > 1. Device is ready to write
> > 2. Device writes
> > 3. Program is doing select()
> > 4. select() returns > 0
> > 5. Device gets disconnected and the kernel discards all information
> > regarding the device
> > 6. Program is doing read()
> > 7. read() fails
>
> Failing immediately is ok. You said it was hanging for you, that was
> what I didn't like.

You're right. I should have said hangs. I will report it to the bluez people.

take care,
pkot
-- 
Pawel Kot




reply via email to

[Prev in Thread] Current Thread [Next in Thread]