gcc/libjava/testsuite/libjava.lang/Thread_Sleep.java
Bryce McKinlay e8904f655d Thread_Wait.java: New file.
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
2000-03-23 12:35:44 +00:00

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.");
}
}
}