Overview
| Artifact ID: | be1ff782f531fcd4ab1c6b29cc22cc2cf3bd2304 |
|---|---|
| Ticket: | 1593707fffffffffffffffffffffffffffffffff
win32 error during simultaneous file open for read |
| User & Date: | georgeps on 2007-12-15 05:29:30 |
Changes
- icomment:
Logged In: YES user_id=585068 Originator: NO After reading MSDN I'm not sure this is a bug that is fixable in Tcl, without a hack that really wouldn't be appropriate. To quote from MSDN: "When a process attempts to open a file that has already been opened in sharing mode, the system compares the requested access and sharing modes to those specified when the file was opened. If you specify an access mode that conflicts with the sharing mode specified in the previous open call, CreateFile fails with a sharing violation (ERROR_SHARING_VIOLATION)." I think this means you just can't do some things in Windows that you want to do, unless you remove the FILE_SHARE_* flags from the CreateFile call. However, I just noticed that NativeStat() in the win tree uses "FILE_SHARE_READ | FILE_SHARE_WRITE" (used to detect permissions it seems) with CreateFile. There could be a race between the stat in one thread, and an open in another. So even though you only want one handle open, the stat is causing the open to fail in some cases. This isn't good...
- login: "georgeps"
- mimetype: "text/plain"
- username: "georgeps"