diff options
author | hobbs <hobbs> | 2002-04-23 02:54:59 (GMT) |
---|---|---|
committer | hobbs <hobbs> | 2002-04-23 02:54:59 (GMT) |
commit | 040db1e7b18a9cd02768a9c65da1a305bf09b4ab (patch) | |
tree | 3518315d00ef1af1aeab9e2258e1d1c128bf5fb1 | |
parent | 498e58924c0478e6d7b27c78146dce35b9bc460b (diff) | |
download | tcl-040db1e7b18a9cd02768a9c65da1a305bf09b4ab.zip tcl-040db1e7b18a9cd02768a9c65da1a305bf09b4ab.tar.gz tcl-040db1e7b18a9cd02768a9c65da1a305bf09b4ab.tar.bz2 |
* generic/tclIOUtil.c (Tcl_FSRegister, Tcl_FSUnregister):
corrected calling of Tcl_ConditionWait to ensure that there would
be a condition to wait upon.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | generic/tclIOUtil.c | 23 |
2 files changed, 19 insertions, 10 deletions
@@ -1,5 +1,11 @@ 2002-04-22 Jeff Hobbs <jeffh@ActiveState.com> + * generic/tclIOUtil.c (Tcl_FSRegister, Tcl_FSUnregister): + corrected calling of Tcl_ConditionWait to ensure that there would + be a condition to wait upon. + + * generic/tclCmdAH.c (Tcl_FileObjCmd): added cast in FILE_SIZE. + * win/tclWinFCmd.c (DoDeleteFile): check return of setattr API calls in file deletion for correct Win32 API handling. diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c index e17179b..f8b395e 100644 --- a/generic/tclIOUtil.c +++ b/generic/tclIOUtil.c @@ -17,7 +17,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclIOUtil.c,v 1.39 2002/04/03 08:39:27 vincentdarley Exp $ + * RCS: @(#) $Id: tclIOUtil.c,v 1.40 2002/04/23 02:54:59 hobbs Exp $ */ #include "tclInt.h" @@ -591,8 +591,7 @@ Tcl_FSRegister(clientData, fsPtr) return TCL_ERROR; } - newFilesystemPtr = (FilesystemRecord *) - ckalloc(sizeof(FilesystemRecord)); + newFilesystemPtr = (FilesystemRecord *) ckalloc(sizeof(FilesystemRecord)); newFilesystemPtr->clientData = clientData; newFilesystemPtr->fsPtr = fsPtr; @@ -601,7 +600,7 @@ Tcl_FSRegister(clientData, fsPtr) * anyone is welcome to ckfree us. */ newFilesystemPtr->fileRefCount = 1; - + /* * Is this lock and wait strictly speaking necessary? Since any * iterators out there will have grabbed a copy of the head of @@ -616,9 +615,11 @@ Tcl_FSRegister(clientData, fsPtr) * a very rare action, this is not a very important point. */ Tcl_MutexLock(&filesystemMutex); - filesystemWantToModify++; - Tcl_ConditionWait(&filesystemOkToModify, &filesystemMutex, NULL); - filesystemWantToModify--; + if (filesystemIteratorsInProgress) { + filesystemWantToModify++; + Tcl_ConditionWait(&filesystemOkToModify, &filesystemMutex, NULL); + filesystemWantToModify--; + } newFilesystemPtr->nextPtr = filesystemList; filesystemList = newFilesystemPtr; @@ -664,9 +665,11 @@ Tcl_FSUnregister(fsPtr) FilesystemRecord *prevFsRecPtr = NULL; Tcl_MutexLock(&filesystemMutex); - filesystemWantToModify++; - Tcl_ConditionWait(&filesystemOkToModify, &filesystemMutex, NULL); - filesystemWantToModify--; + if (filesystemIteratorsInProgress) { + filesystemWantToModify++; + Tcl_ConditionWait(&filesystemOkToModify, &filesystemMutex, NULL); + filesystemWantToModify--; + } tmpFsRecPtr = filesystemList; /* * Traverse the 'filesystemList' looking for the particular node |