This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Linux / UNIX and the fly likes using wait & sleep Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "using wait & sleep" Watch "using wait & sleep" New topic

using wait & sleep

minal silimkar
Ranch Hand

Joined: Nov 25, 2007
Posts: 133
I tried sleep & wait command as shown below.

In the script, there are two while loops. Each is having sleep command.
first loop is going in the sleep for 5 seconds and second loop is going in the loop for 2 seconds. I want when first loop goes in the sleep second loop should start it's execution & when second goes in the sleep first should start the execution.

But after execution it completes first_loop and then starts second_loop execution.

[ June 20, 2008: Message edited by: minal silimkar ]

Minal Silimkar
jQuery in Action, 2nd edition
subject: using wait & sleep
Similar Threads
Code using Loops
Nested loop and break
Need Help Reviewing For Exam
Threads and Synchronization examples
Where is the Context Switch Effect in Java?