lkml.org 
[lkml]   [2001]   [Jun]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: PROBLEM: I/O system call never returns if file desc is closed in the
At 22:35 +0100 2001-06-06, Alan Cox wrote:
> > This report describes a problem in the usage of file descriptors across
>> multiple threads. When one thread closes a file descriptor, another
>> thread which waits for an I/O on that file descriptor is not notified
>> and blocks forever.
>
>THe I/O does not block forever, it blocks until completed.

That's still "forever" if you don't specify a timeout in the select.

>The actual final
>closure of the object occurs when the last operation on it exits

Select is defined as to return, with the appropriate bit set, if/when
a nonblocking read/write on the file descriptor won't block. You'd
get EBADF in this case, therefore causing the select to return would
be a Good Thing.

A related problem is that the second thread my be inside a blocking
read() instead of a select() call. It'd never continue. :-(

HOWEVER: IMHO it's bad design to distribute the responsibility for
file descriptors between threads.
Therefore I think that this behavior is a bug, but it's not one that
needs to be fixed yesterday.
--
Matthias Urlichs
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 12:54    [W:0.097 / U:0.148 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site