Monitoring the main max thread. (Multi threading auto saves)

Hi,

Have you ever found yourself frustrated with max autosaves?
Well I have so I have written a script to give me the control over them that I want, however one of the key features is it saves the scene through a dotNet background worker thread so the UI doesn’t lock up. (Larger files can cause the lock up to last for 1min+)

So far it is pretty stable, but if I run a plugin (currently the simplygon plugin) which freezes the UI and the background thread kicks off to save, it crashes the scene. Now I am trying to find out if there is away of monitoring or checking if the main UI thread is locked so I can prevent the autosave from occurring during this time.

Any advice or direction pointing would be great!?

You can try this before your save function: windows.processPostedMessages()