X-Spam-Check-By: sourceware.org
Subject:  read()  blocking and TIOCINQ
Message-ID: <44EABC07.3010305@esrf.fr>
Date: Tue, 22 Aug 2006 10:10:47 +0200
From: Ernesto Paiser <paiser@esrf.fr>
Reply-To: paiser@esrf.fr
User-Agent: Thunderbird 1.5.0.5 (Windows/20060719)
MIME-Version: 1.0
To: cygwin@cygwin.com
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Virus-Status: Clean
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

Hello Corinna,
I have problems with read() function blocking and
waiting for characters on serial line with cygwin:

Here are some code fragments:
========================================================
fd = open(sl, O_RDWR | O_NOCTTY | O_NONBLOCK | O_NDELAY)

newpio.c_cflag = brate | CS8 | CLOCAL | CREAD;
newpio.c_iflag = IGNPAR | ICRNL;
newpio.c_oflag = 0;
newpio.c_lflag = 0;
newpio.c_cc[VTIME]    = 1;
newpio.c_cc[VMIN]     = 0;
...

n = ioctl(fd, TIOCINQ, &n); //It gives me an error (return -1) why??!!!

and

n = read(fd, buffer, 1);  <<< HERE IS BLOCKING!!!
========================================================

TIOCINQ is working on CYGWIN,

Is there another way to solve this problem???

Thank you in advance,
  Ernesto.

-- 
Ernesto PAISER ____________________ paiser@esrf.fr
E.S.R.F. - European Synchrotron Radiation Facility
6 rue Jules Horowitz  BP 220 Grenoble CEDEX France
phone +33 4 76 88 23 48      fax +33 4 76 88 23 25


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

