From: markspace on
vaibhav wrote:
> Hi all,
> I have a java program with 3 thread, thread1 , thread2 ,
> thread3. When I call thread1.run() , thread2.run() and
> thread3.run() .. the execution of thread1 and thread2 start but
> thread3 does not run.
> Thread1 contains linked list handling , Thread2 contains
> execution of "tcpdump" command and Thread3 contains execution of
> "ping" command. Can anybody tell me why my thread3 is not running ??


I have to answer what Lew said: We need real code to understand what
the problem is. There's no way to answer "why my thread3 is not
running" other than with "because you made a mistake."

Please post an SSCCE so we can answer your question properly.

http://sscce.org/

From: Daniel Pitts on
On 3/13/2010 12:58 AM, vaibhav wrote:
> Hi all,
> I have a java program with 3 thread, thread1 , thread2 ,
> thread3. When I call thread1.run() , thread2.run() and
> thread3.run() .. the execution of thread1 and thread2 start but
> thread3 does not run.
> Thread1 contains linked list handling , Thread2 contains
> execution of "tcpdump" command and Thread3 contains execution of
> "ping" command. Can anybody tell me why my thread3 is not running ??
Well, for one thing you should call Thread.start() to start a thread.
Thread.run() won't actually start up a new thread, but simply run it in
the current thread.

If your tcpdump blocks until it receives information, then it will
prevent thread3 from ever starting.


Try using start() instead of run().

--
Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>