As I started to try out more complex simulations with full figures and drop cloths and costumes a serious issue with the Cloth Deformer emerged. A task switch in windows or a screen saver timeout would totally kill the simulation. The only way to keep it going was to start the simulation and then make sure to give the mouse a shake every few minutes. If I was away for too long then hitting escape to stop the simulation would immediately bring up my blank screen saver letting me know it had died.
I could not find an answer or get much help with this and had to try and carry on without being able to run longer simulations then walk away or leave them overnight. I had to be there at the desktop or nearby and keep an eye on the clock.
I was looking for a solution in the wrong places and wasting precious time too. I assumed it was a Carrara SDK issue and that I was doing something wrong. It was really only when I noticed that after running a big demanding render on multiple cores that upon returning to a word document, after leaving it open on the desktop untouched for an hour, that as I typed there was no response to my keystrokes. After more than a few seconds I could start to type okay.
So I seem to have finally understood and hopefully fixed this problem. Windows is deciding that despite it working hard and doing millions of calculations that my simulation is not important or not responding and then making it, or the system, idle after a certain time period. Only by calling WINAPI SetThreadExecutionState(…) with the right flags, very frequently, in all of the simulation loops, can the plugin now be left to run on its own.