summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorhobbs <hobbs>2002-04-23 02:54:59 (GMT)
committerhobbs <hobbs>2002-04-23 02:54:59 (GMT)
commit040db1e7b18a9cd02768a9c65da1a305bf09b4ab (patch)
tree3518315d00ef1af1aeab9e2258e1d1c128bf5fb1 /generic
parent498e58924c0478e6d7b27c78146dce35b9bc460b (diff)
downloadtcl-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.
Diffstat (limited to 'generic')
-rw-r--r--generic/tclIOUtil.c23
1 files changed, 13 insertions, 10 deletions
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