We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpIntegration › Using exit() without exiting a wrapper
Page Index Toggle Pages: 1
Using exit() without exiting a wrapper (Read 1104 times)
Using exit() without exiting a wrapper
Feb 24th, 2009, 10:38pm
 
Hi folks,

I'm trying to call a processing sketch and return to call a different processing sketch.  Unfortunately, calling exit() within the spawned sketch seems to kill my parent method.  Any ideas?

./A
Re: Using exit() without exiting a wrapper
Reply #1 - Feb 25th, 2009, 12:12am
 
exit() calls Java's System.exit(0), which "Terminates the currently running Java Virtual Machine.".
I suppose the PDE keeps running because it spawns the sketch's applet in its own JVM.
Either you do that, or you just remove exit() call from your sketches...
Re: Using exit() without exiting a wrapper
Reply #2 - Feb 25th, 2009, 12:26am
 
Yes, I figured that happened.  Is there a way to terminate the sketch short of starting a new JVM?  I'm hoping that there's some support within Processing that will allow me to shut down the active threads and clean up (and perhaps even notify a parent thread or method) without calling System.exit.
Re: Using exit() without exiting a wrapper
Reply #3 - Feb 25th, 2009, 1:18pm
 
You can try and call stop(), it terminates the draw() thread, dispose of current graphics context, and do some other clean up. I don't know if exit() is eventually called after that.
Re: Using exit() without exiting a wrapper
Reply #4 - Feb 27th, 2009, 10:04am
 
I'm sorry, I can't answer to your question, but can you tell me how to call another sketch in a principal one? What is the command you use? I just want to execute the lines which are in a secondary file into the main sketch. Can you explain me how?

Thanks

Ptijo
Re: Using exit() without exiting a wrapper
Reply #5 - Feb 27th, 2009, 12:53pm
 
P'tit Jos, you can't "execute the lines". Despite the appearances, Processing sketches are compiled (behind the scene, in a temp dir) before running them.

I think such compound sketches are made with an Java program.
Re: Using exit() without exiting a wrapper
Reply #6 - Feb 27th, 2009, 1:45pm
 
Ok, thanks c'est dommage.
Bye
Ptijo
Page Index Toggle Pages: 1