www.delorie.com/archives/browse.cgi | search |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sources.redhat.com/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/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 |
To: | cygwin AT sources DOT redhat DOT com |
Subject: | select question |
From: | nbecker AT hns DOT com (Neal D. Becker) |
Date: | 25 Nov 2002 15:00:17 -0500 |
Message-ID: | <x881y59ju7i.fsf@rpppc1.md.hns.com> |
Lines: | 27 |
MIME-Version: | 1.0 |
X-Filtered: | Sendmail MIME Filter v1.0.7 excore1.hns.com gAPK0H118642 |
I'm trying to use select to see if there is any user input (that would be stdin, file descriptor 0). If not I want to run my background computation. I want to execute this loop at a pretty high rate (on the order of 100 usec). I tried the following: fd_set set; FD_ZERO(&set); FD_SET (0, &set); timeval timeout; timeout.tv_usec = 200; timeout.tv_sec = 0; int res = select (1, &set, 0, 0, &timeout); if (res == 0) { do computation else read user input The problem is it seems to be ignoring the user input, even though the load average (as reported by top) is still quite low. Is there a problem with select being used this way? Is there a better way to implement this with cygwin? -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |