workaround for thread end problem on program close

This commit is contained in:
Martin Zietz
2021-02-10 11:46:23 +01:00
parent ca2f094ef8
commit 95295e1f61
3 changed files with 10 additions and 5 deletions
+5 -3
View File
@@ -56,15 +56,17 @@ class ExecCSVThread(Thread):
t = time.time() - t_zero # get relative time
if t >= array[i, 0]: # time for this row has come
# g.threadLock.acquire(0)
g.threadLock.acquire() # execute the next few lines before going back to the main thread
field_vec = array[i, 1:4] # extract desired field vector
ui.ui_print("%f s: t = %0.2f s, target field vector = "
ui.ui_print("%f s: t = %0.2f s, target field vector = " # ToDo: better printing
% (time.time() - t_zero, array[i, 0]), field_vec * 1e6, "\u03BCT")
func.set_field(field_vec) # send field vector to test stand
ui.ui_print(time.time() - t_zero)
controller.StatusDisplay.update_labels() # update status display after change
i = i + 1 # next row
# g.threadLock.release()
g.threadLock.release() # allow going back to main thread now
elif t >= array[i, 0] - delay - 0.02: # next change time is close, not enough time to sleep
pass