File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -255,12 +255,20 @@ public class File : IOChannel
255255 {
256256 if (output && output != input)
257257 {
258+ #ifdef _DEBUG
259+ openCountMutex.Wait ();
258260 openCount--;
261+ openCountMutex.Release ();
262+ #endif
259263 fclose (output);
260264 }
261265 if (input)
262266 {
267+ #ifdef _DEBUG
268+ openCountMutex.Wait ();
263269 openCount--;
270+ openCountMutex.Release ();
271+ #endif
264272 fclose (input);
265273 }
266274 input = null ;
@@ -843,7 +851,11 @@ public:
843851 if(!input && !output);
844852 else
845853 {
854+ #ifdef _DEBUG
855+ openCountMutex.Wait();
846856 openCount++;
857+ openCountMutex.Release();
858+ #endif
847859 result = true;
848860 // TESTING ENABLING FILE BUFFERING BY DEFAULT... DOCUMENT ANY ISSUE
849861 /*
@@ -1002,7 +1014,10 @@ public FileAttribs FileExists(const char * fileName)
10021014 return FILE_FileExists (fileName);
10031015}
10041016
1017+ #ifdef _DEBUG
10051018static int openCount;
1019+ static Mutex openCountMutex { };
1020+ #endif
10061021
10071022public File FileOpen (const char * fileName, FileOpenMode mode)
10081023{
@@ -1054,7 +1069,11 @@ public File FileOpen(const char * fileName, FileOpenMode mode)
10541069 if (!file.input && !file.output );
10551070 else
10561071 {
1072+ #ifdef _DEBUG
1073+ openCountMutex.Wait ();
10571074 openCount++;
1075+ openCountMutex.Release ();
1076+ #endif
10581077 result = file;
10591078 // TESTING ENABLING FILE BUFFERING BY DEFAULT... DOCUMENT ANY ISSUE
10601079 /*
You can’t perform that action at this time.
0 commit comments