Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[Manta] Re: Proper threads clean up at exit


Chronological Thread 
  • From: Abe Stephens < >
  • To:
  • Subject: [Manta] Re: Proper threads clean up at exit
  • Date: Fri, 27 Mar 2009 10:42:02 -0600

Hi,

I have and example that successfully starts up/shutdowns... somewhere. I've used the case to test multiple configurations of manta without reloading large data sets.

I'll see if I can track down my example script, but if I remember correctly calling rtrt->finish() sets the total number of worker threads to zero, and then a termination callback is executed to notify the application thread when worker thread 0 finishes. After all of the worker threads exit, and the termination callback is invoked, it should be safe to delete the MantaInterface instance. The scene would need to be deleted separately.

Abe


On Mar 27, 2009, at 10:10 AM, Bo Huang wrote:

Hi

I need a mechanism that stops the rendering the threads while blocking the main thread. Then let main thread delete rtrt and and then continue execution.

Currently my main thread creates four manta rendering threads and let them run, while the main thread processes system events, creates callbacks and feed to Manta.

When it is time to destroy Manta, in my main thread I call delete rtrt. But the other four threads are still running and operate on partially delete memory, hence the execution crashes.

I tried asking each worker to stop, Thread::exitAll(0), and etc., prior to calling delete rtrt. But they do not seem to help, perhaps these calls are not executed immediately? Possibly have to use callbacks?

I also tried running the command line version of Manta with argument
"-ui" "null" "-scene" "scene_0()" "-res" "512x512" "-imagedisplay" "file(testmanta -type tga)"

The images render fine. But when I close the dos window, I see some errors that quickly disappear. (I discerned null thread pointer) In any case, I do not hit the break point I set at delete rtrt in manta.cc.

Hence I wonder if these two are related.

Thanks

Bo




Archive powered by MHonArc 2.6.16.

Top of page