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 & HelpSyntax Questions › Load XML file in the background
Page Index Toggle Pages: 1
Load XML file in the background (Read 1036 times)
Load XML file in the background
Jul 20th, 2009, 11:15am
 
Hi.
Is it possible to load an xml file in the background without slowing down the draw loop?

For example, I want t write a programme that loads an XML file from the internet when the user klicks on a moving object on the screen. If the xml file is too large, the moving objects will stop until the file is loaded. Since the I the URL of the XML file is influenced by the user, i can't load it in setup().

Is it possible to avoid this break?
Re: Load XML file in the background
Reply #1 - Jul 20th, 2009, 1:41pm
 
maybe that helps :
http://processing.org/discourse/yabb2/?num=1204990614
Re: Load XML file in the background
Reply #2 - Jul 21st, 2009, 6:50am
 
here a tutorial about threads

http://www.shiffman.net/teaching/a2z/threads/

but be warned, this is ueberhacker voodoo stuff.  Shocked
Re: Load XML file in the background
Reply #3 - Jul 21st, 2009, 8:54am
 
alvaro wrote on Jul 21st, 2009, 6:50am:
this is ueberhacker voodoo stuff.
Not really, threads are really simple: put computation in a function, run it in a thread...

Now, what is hard, is how to use the result of computation (update once it is computed), how to share data between two or more threads, how to synchronize threads, etc. Smiley
Re: Load XML file in the background
Reply #4 - Jul 21st, 2009, 10:15am
 
i'ts no uberhacker stuff Wink i could implement it in my code within an our or so and I'm far from being uberhacker..
Re: Load XML file in the background
Reply #5 - Jul 22nd, 2009, 5:10am
 
you can -> you are  Smiley

whenever I do something with threads, I get an "Illegal Monitor state Exception" or my thread doesn't stop when the programm exits. I think there's something fundamentally fishy with my threading. So please post your code when you're done, I'll sure like to see it.
Page Index Toggle Pages: 1