What is it meant by "Maya API and Maya Command architectures are not thread-safe"

i started reading about python and threading, where it was mentioned that “Maya API and Maya Command architectures are not thread-safe”, what is that state that causes exception or that has unforeseen side effects?

Well, there are two basic areas where you may have to worry about thread safety. The first is where you have constructed a UI outside the normal Maya native UI methods which has callbacks to code that might get executed even when Maya is busy doing other things, and the second is where you manually create one or more threads (in whatever language) that might try to talk to Maya at the same time, or when it is busy doing something else.

http://download.autodesk.com/global/docs/maya2013/en_us/files/Python_Python_and_threading.htm


In the UI Case, you can usually just follow the rules stated in the first link, and your callback will “wait” for a time when Maya is ready to process it.

In the case of multiple threads accessing the API, you will need to spend some time digesting how this all works (I can’t say I’m an expert). The simplest way to prevent thread conflicts in a multithreaded system is to have a single thread that is responsible for talking to Maya, and separate worker threads that might do “stuff” with that data. For example, you could write an image manipulation plugin that uses SIMD instructions to do fast processing on image data, and a separate CPU thread that composites that image data together with an image from a physical camera, and a third thread that has the responsibility of fetching the data up front and then shoving it back into Maya when it’s ready.

The good news is that if this stuff seems strange to you, you are unlikely to run into issues in the near future. It isn’t until you start doing “fancy” things that this is likely to become a problem.

second link is precisely what i was looking for…