mirror of
git://gcc.gnu.org/git/gcc.git
synced 2024-12-28 02:14:58 +08:00
e8904f655d
2000-03-23 Bryce McKinlay <bryce@albatross.co.nz> * libjava.lang/Thread_Wait.java: New file. * libjava.lang/Thread_Sleep.java: New file. * libjava.lang/Thread_Monitor.java: New file. * libjava.lang/Thread_Wait.out: New file. * libjava.lang/Thread_Sleep.out: New file. * libjava.lang/Thread_Monitor.out: New file. * libjava.lang/Thread_Interrupt.java: New file. * libjava.lang/Thread_Wait_2.java: New file. * libjava.lang/Thread_Wait_2.out: New file. * libjava.lang/Thread_Wait_Interrupt.java: New file. * libjava.lang/Thread_Wait_Interrupt.out: New file. * libjava.lang/Thread_Interrupt.out: New file. * libjava.lang/Thread_Join.java: New file. * libjava.lang/Thread_Join.out: New file. * libjava.lang/Thread_Alive.java: New file. * libjava.lang/Thread_Alive.out: New file. From-SVN: r32706
25 lines
576 B
Java
25 lines
576 B
Java
// Test that Thread.sleep() works.
|
|
// Origin: Bryce McKinlay <bryce@albatross.co.nz>
|
|
|
|
public class Thread_Sleep
|
|
{
|
|
public static void main(String args[])
|
|
{
|
|
try
|
|
{
|
|
long start = System.currentTimeMillis();
|
|
System.out.println("sleeping");
|
|
Thread.sleep(1000);
|
|
long end = System.currentTimeMillis();
|
|
if ((end - start) > 1100 || (end - start) < 990)
|
|
System.out.println ("failed");
|
|
else
|
|
System.out.println("ok");
|
|
}
|
|
catch (InterruptedException x)
|
|
{
|
|
System.out.println("error: Thread interrupted.");
|
|
}
|
|
}
|
|
}
|