Ver Mensaje Individual
  #5 (permalink)  
Antiguo 16/04/2007, 13:04
Avatar de Viet
Viet
 
Fecha de Ingreso: octubre-2003
Ubicación: Mar del Plata - Argentina
Mensajes: 247
Antigüedad: 23 años
Puntos: 2
Re: Servicio Web y Thread(Hilos)

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?
__________________
Keep it simple and keep it fast.