02-22-05 07:52 AM
In article <43845182.0502212112.13a8238a@posting.google.com>,
sacjuhu2002@yahoo.com.sg (soren juhu) wrote:
> Hi all,
>
>
> I have a multi threaded application in which multiple threads are
> running and are moving files from one directory to another directory.
> This involves two fopen calls, one to open the existing file in one
> directory and another to open a new file in the destination directory.
> I have found that sometimes one existing file and one new file in
> different threads have same file descriptor. Is this possible ?
No. Multiple threads share the same file table so it's not possible for
two files opened by the same process to have the same descriptor value.
I suspect your diagnostic method has a concurrency flaw. For example the
moment a file is closed it is possible (and likely) that that value will
be returned by a subsequent open call.
Mike
[ Post a follow-up to this message ]
|