lkml.org 
[lkml]   [1996]   [Aug]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: CLONE_FILES problem.
bof@saarlink.de (Patrick Schaaf) writes:

>>Depends on what you want to do. For files at least, I'd want the file
>>descriptor to be closed, period. This means that if thread A reads from the
>>modem and thread B wants to close things down, thread B close()s the file
>>and A notices this somehow (EOF, signal, whatever).

>I think we agreed (I did :) that the situation at hand is a programming
>error anyway, and we should only be concerned that the kernel does not crash.

>Thread A sits in read() while B closes the file. If the read() returns
>later, the next read() will result in EBADF,

Only if no other cloned thread has done an open() in the mean time
which returns the same file descriptor that close() just freed. In
that case, the read() will happily read from the newly opened file.

I recently wrote a device driver for NeXTSTEP in which a close() from
one thread forces an EBADF error on any pending reads in other
threads. This was ideal behaviour for the application I was
supporting, but I have no idea whether it would be a good thing in the
general case.

Tom.

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