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 › Threads and scope.
Page Index Toggle Pages: 1
Threads and scope. (Read 250 times)
Threads and scope.
Jan 21st, 2009, 8:56pm
 
Can I call a toplevel function from within a threaded (runnable) object?

I'm trying to convert code that now exists within draw() as a timer that calls a function beat() which updates an array into a threaded object.  I can get it to compile but it doesn't seem that beat() is ever called from the threaded object.

So, because I probably just made a logic error, I need someone to confirm or deny that what I am trying to do, call an outside function from a runnable, should in theory be possible...

If i have an arbitrary function beat() shouldn't

draw(){
 beat();
}

and

some runnable(){
 run(){
   beat();
 }
}

produce the same result?
Re: Threads and scope.
Reply #1 - Jan 21st, 2009, 11:05pm
 
Yes this works fine. I figured out what was wrong.

Hooray for threads!
Page Index Toggle Pages: 1