shotgunsoftware/tk-core — pull request #99 by manneohrstrom (2014-08-29 12:56:41+00:00)
Title: #26331 Better threading protection around shotgun API in toolkit

This implements the `tk.shotgun` property accessor such that it is stored in a threadlocal storage. This means that each thread will get a separate instance of the Shotgun API when calling `tk.shotgun`, even if the `tk` instance is shared across threads.

This provides a layer of protection around the Shotgun API which isn't threadsafe.
The result is that while you couldn't previously have multiple threads picking up `tk.shotgun` and running concurrent queries, this is now possible. Note that this also affects some API methods (for example the publish method) which also uses the `tk.accessor`. The overall result is improved thread safety for any Shotgun call made via toolkit.