Node: Multi-Threading, Previous: Shadows, Up: Future Plans



Multi-Threading

When 3DLDF is run, there is only one thread of execution. However, it could benefit from the use of multiple threads. In particular, it may be faster and more efficient to have Picture::output() run in its own thread. In this case, it will no longer be possible to share current_picture among figures.

It may also be worthwhile to execute the code for "figures", i.e., the code between beginfig() and endfig(), inclusive, in their own threads. This will require some changes in the way data are handled. For example, if non-constant objects are shared among figures, there may be no advantage to multi-threading because of the need to coordinate the access of the threads to the objects. If threads are used, then non-constant objects should be declared locally within the figure. They may be locally declared copies of global objects. Alternatively, beginfig() could be changed so that objects could be passed to it as arguments, perhaps as a vector<void*> and/or a vector<Shape*>.