Python threading and Maya
 
 
 

One important difference between Python threads and C++-based threads is that python threads do not run concurrently since the Python interpreter itself is not currently threadsafe. For this reason, they are not useful for data parallel applications. However, they may be useful, for example, where polling of resources is done that might otherwise have to wait for timeouts.

Python supports many of the threading primitives of C++-based threads, including thread pools, semaphores, locks, conditions and events. Threading functionality is described in the online python docs here: http://www.python.org/doc/lib/module-threading.html

Python timer objects derive from the Thread class and can be used for periodic activities.

A supplied script, thread.py, shows some simple threading examples using Python. Python threads will just work when run from within Maya, there is no major extra work required.