Subject: Re: java spinner

From: Greg Noel <[email-masked]>
Date: 11 Mar 1996 23:32:11 -0800

>// Thought i should share this.  can you simplify?  --strick

Will this do?

-- Greg

public class Spinner extends Thread
{
        public static long spin(long millis)
	{
		long counter = 0;
		Thread t = new Spinner(millis);
		t.start();
		do {
			++counter;
			Thread.yield();
		} while (t.isAlive());
                return counter;
        }

        private long millis;

        private Spinner(long millis)
	{
                this.millis= millis;
        }

        public void run() {
                try {
                        Thread.sleep(millis);
                } catch (InterruptedException ex) {
		}
        }
}