Posts: 30
Joined: Apr 2012
Reputation:
0
Hello, I would like to know if XBMC Python supports multiprocessing in general. I tried to do some coding by creating a new thread in a python crypts for an addon. But XBMC doesn't seem to get it. Which is weird because this basic code works in IDLE.
Does XBMC simply block new threads for whatever reason (like avoid creating zombie threads)?
Posts: 12,706
Joined: Nov 2003
Reputation:
129
spiff
Team-Kodi Member
Posts: 12,706
uh, no. threads are fine. forks i've been told have some issues on some platforms.
Posts: 261
Joined: Mar 2015
Reputation:
24
Thanks for posting this.
I wonder if this still holds true in kodi17.
off to threading for me...
Posts: 1,660
Joined: Jun 2011
Reputation:
119
multiprocessing and subprocess modules serve different purposes.
Yes, multiprocessing can be used in Kodi, but you need to take into account all possible pitfalls. For example, on Windows the module where you use multiprocessing must be importable without side-effects. And all data passed to child processes must be picklable. Also multiprocessing.Manager is broken on Widows.
All this makes multiprocessing tricky to use, so for IO-bound tasks or tasks with C-API calls (including time.sleep which releases the GIL for the duration of sleeping) it's better to use multithreading.
Posts: 180
Joined: Aug 2016
2016-11-04, 17:19
(This post was last modified: 2016-11-04, 17:20 by User 342716.)
Multiprocessing is not available on android platforms I have used. Anything I had using this module had to be changed to the threading module.
No issues on Windows for me. But as you can see from the other replies, it is not the best option for multi platform Support imo.