www.delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
X-SWARE-Spam-Status: | No, hits=-2.0 required=5.0 tests=BAYES_00,SARE_MSGID_LONG40,SPF_PASS |
X-Spam-Check-By: | sourceware.org |
MIME-Version: | 1.0 |
Date: | Tue, 28 Jul 2009 13:00:09 +0200 |
Message-ID: | <b000da060907280400q3ad7d39awcdd3ff2514e987c4@mail.gmail.com> |
Subject: | 1.7.0: read() blocking with VMIN = VTIME = 0 |
From: | =?ISO-8859-1?Q?daniel_=E5kerud?= <daniel DOT akerud AT gmail DOT com> |
To: | cygwin AT cygwin DOT com |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Id: | <cygwin.cygwin.com> |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sourceware.org/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
Sender: | cygwin-owner AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
Delivered-To: | mailing list cygwin AT cygwin DOT com |
Hello! With my example program below the read() is blocking even though canonical input is set and VMIN = VTIME = 0. It is supposed to act in a non-blocking way. Does not work on: CYGWIN_NT-5.0 1.7.0(0.212/5/3) 2009-07-24 09:59 Works on: Linux version 2.6.28-13-generic (buildd AT vernadsky) (gcc version 4.3.3 (Ubuntu 4.3.3-5ubuntu4) ) #45-Ubuntu SMP Tue Jun 30 19:49:51 UTC 2009 Example program: #include <stdio.h> #include <unistd.h> #include <termios.h> int main() { char c = 0; struct termios term, term_orig; if(tcgetattr(0, &term_orig)) { printf("tcgetattr failed\n"); return 2; } term = term_orig; term.c_lflag &= ~ICANON; term.c_lflag |= ECHO; term.c_cc[VMIN] = 0; term.c_cc[VTIME] = 0; if (tcsetattr(0, TCSANOW, &term)) { printf("tcsetattr failed\n"); return 2; } printf("Calling read (blocks here on cygwin)\n"); fflush(stdout); read(0, &c, 1); printf("Back from read\n"); tcsetattr(0, TCSANOW, &term_orig); return 0; } Is this supported in Cygwin? The only work around I know for now is to do a select() before read()ing. Best Regards, Daniel -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |