← Back to team overview

sikuli-driver team mailing list archive

[Question #682255]: Custom theading best practices

 

New question #682255 on Sikuli:
https://answers.launchpad.net/sikuli/+question/682255

Are there any recommended approach for custom threading?
I'm already using observers which work pretty well for some cenarios, but I want to leave a thread running some tasks until a observer gets triggered and stops that task.

I'm using something like this -> 
`
     myreg.onVanish(stopTask)
     myreg.observeInBackground(FOREVER)

     taskThread = threading.Thread(target = myTask, args = (taskArg, ))
     taskThread.daemon = True
     taskThread.start()

     while True:
            # keep alive stuff
`

I ran into a few things like **taskThread** not getting stopped with **alt+shift+c** for example
I kinda managed to make it work fine using a custom stop HK.
Just wondering if there are any best practices about custom threading and SikuliX as I couldn't find any information.

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.