Skip to content

Commit 6f50942

Browse files
authored
Merge pull request #2488 from AllenInstitute/bugfix/2488-stop-all-threads-before-uncompiled
BeforeUncompiledHook: Ensure that all preemptive threads are stopped
2 parents a857f56 + 2db41c0 commit 6f50942

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)