How Can I Use Multithreading in Python with Softimage?

Discussions concerning programming of SOFTIMAGE©
User avatar
islasyr
Posts: 16
Joined: 02 Jul 2009, 09:23

How Can I Use Multithreading in Python with Softimage?

Post by islasyr » 17 Oct 2010, 11:24

Hi Friends.. :)

I'm Learning Python.. and I was had some JScript Commands and I've Converted them to Python Succesfully BUT.. :-?

Can I Use Multiple Threading in Softimage by Python?
How? and Would You Please Give me Some Examples??

Thanks Alot.

User avatar
rray
Moderator
Posts: 1810
Joined: 26 Sep 2009, 13:51
Location: Bonn, Germany

Re: How Can I Use Multithreading in Python with Softimage?

Post by rray » 18 Oct 2010, 12:38

You can use multithreading by using the threading module and the Thread class.

Some examples: http://www.devshed.com/c/a/Python/Basic-Threading-in-Python/1/

However while threads get spread across multiple cores, they all have to be pushed through the python interpreter, which runs on 1 core only. That means you'll never get CPU utilization above 25% for a 4-core system for example. Python's age shows a bit here 8-x

Just testing the multiprocessing module. First test shows it doesn't seem to work properly in Softimage. Creating a new process attempts to start a new instance of Softimage also.... Oh well.. Python seems not a great choice for multi-CPU programming. Not wondering why pro python programmers say "multithreading is dangerous and tricky" ;)
softimage resources section updated Sep 26th 2026