Re: g_io_unix_read/g_io_unix_write



Hi David,

> You should only get EINTR if the file was not ready for reading.
> This should never happen if you properly set yourself up,
> for example with g_io_add_watch.
> 
> If you get EINTR it is a sign that you should have called
> polled the file descriptor first or you should make the fd nonblocking
> so you really will get EAGAIN.

While that may be true, I don't think it is guaranteed, you don't get EINTR,
when you have a non blocking fd, which select reported to be ready to be read
from. 

Also you can't expect a user to setup an fd to nonblocking just to be sure to
not get EINTR and why should the user be forced to write:

if (result == G_IO_ERROR_AGAIN || 
    result == G_IO_ERROR_UNKNOWN && errno == EINTR)
  /* do it again */

instead of just 

if (result == G_IO_ERROR_AGAIN)
  /* do it again */

So, if no one objects, I'm pretty determined to apply the following patch:

--- giounix.c	1999/03/23 21:44:16	1.8.2.1
+++ giounix.c	2000/03/06 12:46:23
@@ -165,6 +165,7 @@
 	{
 	case EINVAL:
 	  return G_IO_ERROR_INVAL;
+	case EINTR:
 	case EAGAIN:
 	  return G_IO_ERROR_AGAIN;
 	default:
@@ -196,6 +197,7 @@
 	{
 	case EINVAL:
 	  return G_IO_ERROR_INVAL;
+	case EINTR:
 	case EAGAIN:
 	  return G_IO_ERROR_AGAIN;
 	default:

Any other opinions?

Bye,
Sebastian

-- 
Sebastian Wilhelmi                   |            här ovanför alla molnen
mailto:wilhelmi@ira.uka.de           |     är himmlen så förunderligt blå
http://goethe.ira.uka.de/~wilhelmi   |



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