2012-11-25, 17:01
I am scratching my head on this one, and this clearly deserves a fresh look.
I wrote a script that is started upon XBMC startup, which perdiodically fetches some data from several files, URLs, etc. That data is then used in a modded skin of mine. If you are curious, the thread fetches temperature from my weather station, as well as generates some graphs (see this old post of mine).
The system works perfect, but there is an issue when I want to exit xbmc (pression the shut down button on the gui, for example), at this point xbmc just freezes (screen is dimmed and the RSS feeds stop scolling). This goes for several minutes, and then finally xbmc closes. I know that this is my thread which has slopped is sleep cycle and which then releases xblc to close normally.
I think I am not using pytho threads properly, here is my code (launched at XBMC startup) :
This is what I see in my logs
But apparently, XBMC does not manage to kill this thread. I used the setDaemon on thread initialization but this did not change anything.
Any suggestion?
V.
I wrote a script that is started upon XBMC startup, which perdiodically fetches some data from several files, URLs, etc. That data is then used in a modded skin of mine. If you are curious, the thread fetches temperature from my weather station, as well as generates some graphs (see this old post of mine).
The system works perfect, but there is an issue when I want to exit xbmc (pression the shut down button on the gui, for example), at this point xbmc just freezes (screen is dimmed and the RSS feeds stop scolling). This goes for several minutes, and then finally xbmc closes. I know that this is my thread which has slopped is sleep cycle and which then releases xblc to close normally.
I think I am not using pytho threads properly, here is my code (launched at XBMC startup) :
Code:
import xbmc, xbmcgui
class MeteoThread (threading.Thread):
def __init__(self, threadID, sleeptime):
self.threadID = threadID
self.sleeptime = sleeptime
threading.Thread.__init__(self)
self.setDaemon(True)
def run(self):
while 1==1:
#do some stuff that takes about 10 seconds
... xyz ...
print "[MeteoThread] fetching data complete, now sleeping "+str(self.sleeptime)+" seconds"
time.sleep(self.sleeptime)
print "[Meteo] starting..."
HomeWindow = xbmcgui.Window( 10000 )
pollingthread = JCMeteoThread(0, 60*30)
pollingthread.start()
print "[Meteo] started"
This is what I see in my logs
Code:
15:56:48 T:140168616228736 NOTICE: stop python
15:56:53 T:140168616228736 ERROR: XBPyThread::stop - script didn't stop in 5 seconds - let's kill it
Any suggestion?
V.