Skip to content

Commit 2db41c0

Browse files
committed
BeforeUncompiledHook: Ensure that all preemptive threads are stopped
When you do killdataFolder root:packages and then uncompile/recompile the code you get the message Function module in use by preemptive threads. Kill the thread? The reason is that ASYNC_Stop does not stop the async threads as it's tgID is gone. The only thing we can do is stopping/killing all threads before the IP popup tells us.
1 parent 11c9470 commit 2db41c0

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Packages/MIES/MIES_IgorHooks.ipf

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,8 @@ End
294294

295295
static Function BeforeUncompiledHook(variable changeCode, string procedureWindowTitleStr, string textChangeStr)
296296

297+
variable ret
298+
297299
LOG_AddEntry(PACKAGE_MIES, "start")
298300

299301
// catch all error conditions, asserts and aborts
@@ -308,7 +310,11 @@ static Function BeforeUncompiledHook(variable changeCode, string procedureWindow
308310
// dito
309311
AssertOnAndClearRTError()
310312
try
311-
ASYNC_Stop(timeout = 5); AbortOnRTE
313+
ret = ASYNC_Stop(timeout = 5); AbortOnRTE
314+
315+
if(ret) // error stopping it, stop all threads
316+
ret = ThreadGroupRelease(-2)
317+
endif
312318
catch
313319
ClearRTError()
314320
endtry

0 commit comments

Comments
 (0)