Keeping control over very long tasks
-
Hi to all,
I was wondering if there was a way to give back control to the Tool message loop when performing a long calculations.
To be clearer let's assume you have a piece of code that may take a long while to process. Assuming it is executed in the context of a Tool, it seems that you cannot catch any event while it is processed (such as getting a key or click down). This may be because Sketchup is monothreaded.
I tried to call iteratively each piece of processing in a Start_timer call, but this does not work (in addition the usage of Ruby continuation, callcc, does crash the program).
If you start a seaparet thread, it does not work either (it seems that Skecthup API cannot eb executed ina separated thread).If anyone has an idea, that would be helpful. It is a pity that Sketchup does not have a method for that!
Thanks
Fredo
-
I've had no success either. I guess its because if you look at how its recommended to embed Ruby in an App, its a very simple ruby_run() model. So SU may be multi-threaded or not, but the call to Ruby is a busy wait.
Pretty much the only thing that does work is spawn a Ruby thread that twiddles the Sketchup.set_status_text
Adam
Advertisement