Overview
| Artifact ID: | 2a7476de8a3f11dc2f22b686632570cea1acae75 |
|---|---|
| Ticket: | 1593707fffffffffffffffffffffffffffffffff
win32 error during simultaneous file open for read |
| User & Date: | melbardis on 2006-11-09 19:35:00 |
Changes
- assignee changed to: "vincentdarley"
- cmimetype changed to: "text/plain"
- comment changed to:
If threads in a multi threaded application (or simply multiple copies of a tclsh) try to open the same file for reading, there appears to be a window of opportunity for windows to return an error, typically a ERROR_SHARING_VIOLATION error. Additionally (in another of my applications non-tcl) i found that is a thread closes a file and another thread trys to delete the file, the same window can apply. I have modfied win/tclWinChan.c (8.54a, though same code seems to exist everywhere...) as follows: /* * Now we get to create the file. */ { //EPM - windows can screwup when opening same file at same time int retry = 5; int err; while (retry--) { handle = (*tclWinProcs->createFileProc) (nativeName, accessMode, shareMode, NULL, createMode, flags, (HANDLE) NULL); if (handle != INVALID_HANDLE_VALUE) { break; } err = GetLastError(); if (err == ERROR_FILE_NOT_FOUND) { // File removed by external circumstances. break; } Sleep(100); //printf("retry... %d\n", retry); } } if the retry message is uncommented, then the retry was output occasionally when running the test code, with a retry value of 4 note: my machine is a dual-core pentium 2.8 gig - foundin changed to: "None"
- is_private changed to: "0"
- priority changed to: "5 Medium"
- resolution changed to: "None"
- status changed to: "Open"
- submitter changed to: "melbardis"
- subsystem changed to: "37. File System"
- title changed to: "win32 error during simultaneous file open for read"
- type changed to: "Bug"