I'm working on an extension that opens multiple models simultaneously. Models can be opened and closed dynamically. Models are opened as a LiteWorkspace
so that widgets and such are displayed. Whenever you create a new LiteWorkspace
, it starts up a JobThread
and Lifeguard
. The problem is that shutting down a GUIWorkspace
(the parent class of LiteWorkspace
) doesn't kill its Lifeguard
or JobThread
.
Possible solutions:
The ideal solution would be a to have all models share a
JobThread
, as this would remove number of threads as a cap on how many models one can run. Doing this would have certain performance benefits as well. Is there a chance this is a possible? This solution still require being able to killLifeguard
.Next would be to be able to kill the threads of course.
As a last resort, we could keep around a pool of
GUIWorkspace
s. When the user closes a model, it's thrown back into the pool. Then, when the user loads a new model and there's something in the pool, we just reuse one of thoseGUIWorkspace
s. This would allow us to open the same number of models as with 2. The only downside is that opening a new model (like completely new, from the file menu or whatever) still doesn't kill the threads, so there's this permanent resource baggage hanging around. We actually might have to institute a pool anyway for performance reasons, but it would be really nice to actually be able to free up the resources at some point.