diff options
| author | hobbs <hobbs> | 2002-04-23 02:54:59 (GMT) |
|---|---|---|
| committer | hobbs <hobbs> | 2002-04-23 02:54:59 (GMT) |
| commit | aa57ce352257ebedd31d02f82e9f7af875822234 (patch) | |
| tree | 3518315d00ef1af1aeab9e2258e1d1c128bf5fb1 /generic/tclIOUtil.c | |
| parent | 9bc34708f5f69ff3c0f1961090bac1434b639249 (diff) | |
| download | tcl-aa57ce352257ebedd31d02f82e9f7af875822234.zip tcl-aa57ce352257ebedd31d02f82e9f7af875822234.tar.gz tcl-aa57ce352257ebedd31d02f82e9f7af875822234.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/tclIOUtil.c')
| -rw-r--r-- | generic/tclIOUtil.c | 23 |
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 |
