Esta claro.... sería una cosa asi no:
Código PHP:
public class Math {
public float add(float a, float b) {
// Create and start the thread
Thread thread = new BasicThread1(a,b);
thread.start();
While (!Thread.ended){
sleep(100);
}
return Thread.result;
}
}
class BasicThread1 extends Thread {
// This method is called when the thread runs
int a;
int b;
public int result;
public boolean ended = false;
public BasicThread1(int a,int b){
this.a = a;
this.b = b;
}
public void run() {
result = a+b;
ended = true;
}
}
te entendi bien?