← Back to team overview

sikuli-driver team mailing list archive

[Question #287091]: Problem with threading/multiprocessing

 

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

Hello there,

FIrst off, I need to say I've been using Sikulix for the past week and I'm already loving it for doing some automated tasks and bots for some games.

So here's my issue:

Basically, in the game I have to do some stuff, but when a certain scenario occours, I need to logout and stop whatever I was doing. So I was using threading for this, my module creates a thread that would do: 

wait(scenario, FOREVER))
# actions for logout here #

And in the rest of the module is the task that I was doing. It worked, but I wasn't able to kill the thread, so whenever the program stopped naturally and not by the thread, I noticed that after running it many times there was starting to have some perfomance issues because many threads were still alive (generallly I stopped it with Alt+Shift+C or when the task ended, but the thread still wouldn't stop).

I did some search around, since I've never did anything in python before, I read the thread could be killed if I set it to daemon, and when the non-daemon thread stopped (the main program), it would kill the thread too. I've tried it but failed (maybe I did something wrong?). Then I did some search and thought that multiprocessing might be what I need, so I could kill it when it ended. But I can't import it, I'm guessing the multiproessing module was written in C and Jython doesn't support it.

So I'm wanting to know what would be the best way to handle this situation?  I didn't investigate it further but there's probably some workarounds I could do, I just want to know the recommended way

Again, thanks for this amazing tool!

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