Mon, 21 Aug 2006 17:18:26 +0200

"Zoltan Mozes" <sezoM_natloZ@epam.com>

RE: [Java lista] Re: thread sleep kérdés


Szerintem arra gondoltak hogy szálat a .start() metódus 
meghívásával kell indítani ahelyett hogy közvtlenül a run() 
metódust hívnánk.

Az persze majd meghívja a run()-t.




"The start( ) method in the Thread class performs special initialization 
for the thread and then calls run( ). So the steps are: the constructor 
is called to build the object, it calls start( ) to configure the 
thread, and the thread execution mechanism calls run( ). If you don't 
call start( ) (which you don't have to do in the constructor, as you 
will see in subsequent examples), the thread will never be started."


"If you must control the order of execution of threads, your best bet is 
not to use threads at all, but instead to write your own cooperative 
routines that hand control to each other in a specified order."

http://www.mindview.net/Books/TIJ/


Best Regards,
Zoltán Mózes
Lead SW Test Engineer

EPAM Systems
Budapest office, Hungary (GMT+1)

Office phone:        +36 (1) 327-74-XX
Office fax:            +36 (1) 327-74-20
Mobile phone:       +36 (20) XXX-XXX
E-mail:                 Zoltan Mozes@epam.com

http://www.epam.com

CONFIDENTIALITY CAUTION AND DISCLAIMER
This message is intended only for the use of the individual(s) or 
entity(ies) to which it is addressed and contains information that is 
legally privileged and confidential. If you are not the intended 
recipient, or the person responsible for delivering the message to the 
intended recipient, you are hereby notified that any dissemination, 
distribution or copying of this communication is strictly prohibited. 
All unintended recipients are obliged to delete this message and destroy 
any printed copies.

-----Original Message-----
From: javalist@javasite.bme.hu [mailto:javalist@javasite.bme.hu] 
Sent: Monday, August 21, 2006 4:35 PM
To: javalist@javasite.bme.hu
Subject: [Java lista] Re: thread sleep kérdés

*** Felado: Köteles Ferenc <fecuska@freemail.hu> ***

On Mon, 21 Aug 2006 16:27:35 +0200 (CEST)
javalist@javasite.bme.hu wrote:

> *** Felado: Suller András <suan2@freemail.hu> ***
> 
> javalist@javasite.bme.hu írta:
> > *** Felado: Köteles Ferenc <fecuska@freemail.hu> ***
> >  void nextTry() {
> >   t2.run();
> >   t.run();
> >  }
> void nextTry() {
>    t2.start();
>    t.start();
> }
> 
> A t.run(); nem indítja el a szálat, hanem meghívja a run() 
metódust!
Ez most segített, de nem értem, miért. A szálak ugyanis 
korábban is
futottak, hiszen a konzolra kiírták, amit kell, és megfelelő
időzítéssel (ez is a run metódus része). El tudnád 
magyarázni
szájbarágósabban?


-- 
Minden jót,

Feca

----------------------------------------
Softwared by Debian GNU/Linux
Just because you're paranoid, it doesn't
mean they're not out to get you.

Java Felhasznalok Tarsasaga levelezolista
javalist@javasite.bme.hu, http://javasite.bme.hu/javalist 
hun.comp.lang.java