Results 1 to 2 of 2
Thread: Sleep in thread
- 08-27-2008, 01:17 PM #1
Member
- Join Date
- Jun 2008
- Posts
- 39
- Rep Power
- 0
Sleep in thread
hello friends,
i have to sleep a particular thread...... how to do that? i have given below in my pgm...... if i sleep my particular thread all the threads has slept...... what i have to do for sleep a particular thread .......
class RowlevelLocking extends Thread implements Runnable
{
Thread x,y;
RowlevelLocking()
{
x = new Thread(this,"a");
y = new Thread(this,"b");
x.start();
y.start();
}
public static void main(String arg[])
{
new RowlevelLocking();
}
public void run()
{
while(true)
{
display();
}
}
private void display()
{
System.out.println("welcome.......");
x.sleep(1000);
}
}
here if i sleep the x thread the y thread also sleep............... what i have to do a sleep a separate thread.............
- 08-27-2008, 02:27 PM #2
Similar Threads
-
How to use sleep method of the Thread class
By Java Tip in forum java.langReplies: 0Last Post: 04-09-2008, 06:42 PM -
Can't get my thread to sleep!
By jamesfrize in forum New To JavaReplies: 2Last Post: 03-25-2008, 05:14 AM -
If JNI thread call the java object in another thread, it will crash.
By skaterxu in forum Advanced JavaReplies: 0Last Post: 01-28-2008, 07:02 AM -
How to use the sleep and thread?
By jiuhu in forum Java AppletsReplies: 4Last Post: 08-07-2007, 02:56 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks