From: SourceForge.net <no...@so...> - 2007-07-18 21:38:28
|
Bugs item #1593707, was opened at 2006-11-09 11:35 Message generated for change (Comment added) made by melbardis You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=110894&aid=1593707&group_id=10894 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. >Category: 48. Threading Group: None Status: Open Resolution: None >Priority: 8 Private: No Submitted By: eric melbardis (melbardis) Assigned to: Vince Darley (vincentdarley) Summary: win32 error during simultaneous file open for read Initial Comment: 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 ---------------------------------------------------------------------- >Comment By: eric melbardis (melbardis) Date: 2007-07-18 14:38 Message: Logged In: YES user_id=788816 Originator: YES no response when filed under the previous category! ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=110894&aid=1593707&group_id=10894 |