Hi guys,
I think I really need splitting some methods in different threads upon different core-processors (I have a 8 core device)...
I'm building a light controller and I need a fast way to do several calculations in parallel.
For those who know, I'm speaking of "cue lists" and "effects", for those who don't, imagine you have several (>100) lamps and need to fade their brightness value from X1-value to X2-value,
each lamp with its own X1, X2 and time values...
This operation can be performed by one processor. Another processor can send these values through a serial port or WiFi. The main thread controls the user interface... And so on.
How can I achieve this? I tried the
Agraham's Threading Library, but does not run in debug mode...
I've tried this extension, based on java's threads, but I don't know if it is really correct:
#if JAVA
public Thread bw;
public class backworker extends Thread {
public int looptime=100;
public backworker(int ms) {looptime=ms;}
@Override
public void run() {
Exception lastex=null;
try{
boolean running=true;
while (running) {
Thread.sleep(looptime);
ba.raiseEvent(null,"bk_run",null);
}
Object[] x3={true,null};
ba.raiseEvent(null,"bk_ended",x3);
}
catch(Exception e){
Object[] x2={false,e};
ba.raiseEvent(null,"bk_ended",x2);
}
}
}
public void bw_init(int ms){
bw=new backworker(ms);
}
public void bw_start(){
if(bw!=null) bw.start();
}
public void bw_interrupt(){
if(bw!=null) bw.interrupt();
}
public Thread.State bw_state(){
if(bw==null) return Thread.State.NEW;
return bw.getState();
}
#End If
Thanks in advance