Added lock to stage positioning

This commit is contained in:
Joel Collins 2019-01-24 13:28:46 +00:00
parent 18dec56c80
commit 4be89866ee
2 changed files with 11 additions and 4 deletions

View file

@ -39,12 +39,12 @@ class Plugin(MicroscopePlugin):
print("Starting a long-running task...")
n_array = []
print("Acquiring camera lock...")
with self.microscope.camera.lock:
print("Acquiring camera and stage locks...")
with self.microscope.camera.lock, self.microscope.stage.lock:
for _ in range(t_run):
n_array.append(random.random())
time.sleep(1)
print("Long-running task finished! Releasing lock.")
print("Long-running task finished! Releasing locks.")
return n_array