sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #41420
[Question #449474]: the functions exists()/click()... freezes within a thread
New question #449474 on Sikuli:
https://answers.launchpad.net/sikuli/+question/449474
OS and sikuliX version :
1.1.0(2015-10-05_17:07)/Windows10.0/Java8(32)1.8.0_121-b13
Hi there. First, thanks for the hard work on sikulix!
My question :
I'm running a Sikulix code in an independent Thread implemented using java.land.Thread.
While this thread is running, a region is under observation looking for a pattern to appear. When the pattern show-up, a handler is called with the Thread reference as a second parameter (after event).
This handler should suspend this thread and after doing some work resume it. Within this work there is an (lambda instruction) event.region.click(P)
Sometimes the pattern show up while the thread is running a find/exists operation, and this causes (lambda instruction) to freeze.
##########################################################
Here is a sketch of the code:
def P1Appreared(event,someThread):
global var
someThread.suspend()
event.region.click(button_P)
#do some work involving var
...
if var :
someThread.resume()
else:
someThread.stop()
event.repeat()
def task1():
#some instructions
.....
if R2.exists(someP):
someLocation.click()
waitVanish(someP)
.....
else:
....
def aFunction():
#some instructions
myThread = Thread(task1)
R1.onAppear(P1,lambda event : P1Appeared(event,myThread))
R1.observeInBackground(FOREVER)
myThread.start()
myThread.join()
aFunction()
#####################################################
And i can't avoid using threads because i need the handler to stop/resume the task, otherwise a conflict in using keybord/mouse happens.
Thanks again!
--
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.