www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/02/23/07:41:06

From: kagel AT quasar DOT bloomberg DOT com
Date: Fri, 23 Feb 1996 07:21:52 -0500
Message-Id: <9602231221.AA03857@quasar.bloomberg.com >
To: oandico AT eee DOT upd DOT edu DOT ph
Cc: j DOT aldrich6 AT genie DOT com, djgpp AT delorie DOT com
In-Reply-To: <Pine.SOL.3.91.960223114516.1530A-100000@gollum> (message from Orlando Andico on Fri, 23 Feb 1996 11:47:31 -0800 (GMT))
Subject: Re: errno question: EWOULDBLOCK
Reply-To: kagel AT dg1 DOT bloomberg DOT com

   Errors-To: postmaster AT ns1
   Date: Fri, 23 Feb 1996 11:47:31 -0800 (GMT)
   From: Orlando Andico <oandico AT eee DOT upd DOT edu DOT ph>
   Cc: djgpp AT delorie DOT com
   Mime-Version: 1.0
   Content-Type: TEXT/PLAIN; charset=US-ASCII
   Content-Length: 1304

   On Fri, 23 Feb 1996 j DOT aldrich6 AT genie DOT com wrote:

   > Here's a question for v2:  The errno EWOULDBLOCK, which a
   > large program I am working on uses, does not seem to be defined
   > in errno.h in v2.  I am not even sure what EWOULDBLOCK is used for - I just
   > know that very few C compilers I have tried seem to have any idea what

   EWOULDBLOCK is the error number returned from a read() or write() which 
   *would* block but didn't. For example, if you read from a port which 
   isn't ready, your program sleeps ("blocks") until the data comes in. 
   However, you can set things up such that the port does *not* block, using 
   fcntl() -- although this is for Unix, I don't think it's supported under 
   MS-DOG. Anyway, if the port is set up as nonblocking, you read from it, 
   and there is nothing there, the read immediately returns with a -1 
   (error) but errno == EWOULDBLOCK to tell you the error was caused by 
   unavailability of data, not some hardware error.

Similarly EWOULDBLOCK is returned from message queue, semaphore, mutex lock,
and socket I/O operations which would have blocked if the mechanism had not
been set to non-blocking.

-- 
Art S. Kagel, kagel AT quasar DOT bloomberg DOT com

A proverb is no proverb to you 'till life has illustrated it.  -- John Keats

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019