From 040db1e7b18a9cd02768a9c65da1a305bf09b4ab Mon Sep 17 00:00:00 2001 From: hobbs Date: Tue, 23 Apr 2002 02:54:59 +0000 Subject: * generic/tclIOUtil.c (Tcl_FSRegister, Tcl_FSUnregister): corrected calling of Tcl_ConditionWait to ensure that there would be a condition to wait upon. --- ChangeLog | 6 ++++++ generic/tclIOUtil.c | 23 +++++++++++++---------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index a159bbb..4bd1566 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2002-04-22 Jeff Hobbs + * 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 -- cgit v0.12