Ok guys, here’s what I’ve got: I’m trying to make a thread-based program in Processing.
What the program does is really simple, and I can deal with that, but when I tried to make it run in a thread, it takes fun of me!
Long story short, I’ve tried making something like this:
class supportClass{
[All the junk.];
};
class threadClass extends Thread{
boolean goingThread;
[Some other junk.];
threadClass(){
goingThread = false;
[Junk.]
}
void start(supportClass var){
goingThread = true;
run(var);
goingThread = false;
}
void run(supportClass var){
[Junk which does all the work!]
}
};
And here’s the setup() method:
void setup(){
[Some junk init.];
supportClass mySupportClass = new supportClass();
threadClass myClass = new threadClass();
myClass.start(mySupportClass);
}
So, here’s the issues are two:
1) The frame doesn’t even show itself; I mean: the program seems to not run at all…;
2) I’m not sure of the value-giving method that I’m using, because of the changing of data on mySupportClass.
Searching in StackOverflow I didn’t find anything about parsing values at a thread [In processing], so… Here I am!
Any tip?
@Override the superclass run() method to add your thread code. If you want to have your very own start() method with parameters, fine, but do not call run(), call start().