From ce02f8f5f53256176e348a3334e6a0a857eea58a Mon Sep 17 00:00:00 2001 From: Michael Huth Date: Thu, 15 Aug 2024 12:56:36 +0200 Subject: [PATCH 1/2] DM: Moved killing of trash data folder to own data management function New function: KillTrashFolders No functional changes --- Packages/MIES/MIES_IgorHooks.ipf | 8 +------- Packages/MIES/MIES_MiesUtilities_DataManagement.ipf | 12 ++++++++++++ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/Packages/MIES/MIES_IgorHooks.ipf b/Packages/MIES/MIES_IgorHooks.ipf index 15f2d45779..582f5f4098 100644 --- a/Packages/MIES/MIES_IgorHooks.ipf +++ b/Packages/MIES/MIES_IgorHooks.ipf @@ -28,13 +28,7 @@ static Function IH_KillTemporaries() KillStrings/Z dfrHW:ITCDeviceList // try to delete all trash folders - trashFolders = GetListOfObjects(dfr, TRASH_FOLDER_PREFIX + ".*", typeFlag = COUNTOBJECTS_DATAFOLDER, fullPath = 1) - - numFolders = ItemsInList(trashFolders) - for(i = 0; i < numFolders; i += 1) - path = StringFromList(i, trashFolders) - KillDataFolder/Z $path - endfor + KillTrashFolders() RemoveEmptyDataFolder(dfr) diff --git a/Packages/MIES/MIES_MiesUtilities_DataManagement.ipf b/Packages/MIES/MIES_MiesUtilities_DataManagement.ipf index b6bd782e23..401afceacb 100644 --- a/Packages/MIES/MIES_MiesUtilities_DataManagement.ipf +++ b/Packages/MIES/MIES_MiesUtilities_DataManagement.ipf @@ -90,3 +90,15 @@ threadsafe Function MoveToTrash([wv, dfr]) endif endif End + +threadsafe Function KillTrashFolders() + + string dfPath + + DFREF dfr = GetMiesPath() + WAVE/T trashFolders = ListToTextWave(GetListOfObjects(dfr, TRASH_FOLDER_PREFIX + ".*", typeFlag = COUNTOBJECTS_DATAFOLDER, fullPath = 1), ";") + + for(dfPath : trashFolders) + KillDataFolder/Z $dfPath + endfor +End From 2128a739190b88facea4d3f326cea8609e5c2441 Mon Sep 17 00:00:00 2001 From: Michael Huth Date: Thu, 15 Aug 2024 12:58:25 +0200 Subject: [PATCH 2/2] ASYNC: If TS is disabled then free DF are now moved to a global DF The underlying issue is that for some caching key determination we use WaveModCount that does not support free waves when executed from the main thread. This issue comes up e.g. when the LNB is accessed due to the key wave caching. The solution is to move the prepaed DF to a global location before calling ASYNC_Worker. The global DF is created as a trash* DF in the MIES DF. Since certain actions, like TP acquisition would create a massive amount of these temporary DFs, the trash DFs are cleaned up whenever a new ASYCNC workload is pushed. This is good enough for debugging purposes. --- Packages/MIES/MIES_Async.ipf | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Packages/MIES/MIES_Async.ipf b/Packages/MIES/MIES_Async.ipf index defcdf0ced..ee98ef4acd 100644 --- a/Packages/MIES/MIES_Async.ipf +++ b/Packages/MIES/MIES_Async.ipf @@ -585,6 +585,7 @@ Function ASYNC_Execute(dfr) DFREF dfr variable orderIndex, size, index + string dest ASSERT(ASYNC_IsThreadDF(dfr), "Invalid data folder or not a thread data folder") NVAR tgID = $GetThreadGroupID() @@ -617,6 +618,15 @@ Function ASYNC_Execute(dfr) endif #ifdef THREADING_DISABLED + if(IsFreeDataFolder(dfr)) + KillTrashFolders() + DFREF tmpdfr = GetUniqueTempPath() + dest = RemoveEnding(GetDataFolder(1, tmpDFR), ":") + MoveDataFolder/Z dfr, $dest + if(V_flag) + printf "ASYNC_Execute: Could not move free DF to global DF: %s to %s\r", GetDataFolder(1, dfr), dest + endif + endif DFREF result = ASYNC_Run_Worker(dfr) WAVE/DF serialExecutionBuffer = GetSerialExecutionBuffer(getAsyncHomeDF()) index = GetNumberFromWaveNote(serialExecutionBuffer, NOTE_INDEX)