How about a Thread.sleep() instead of a busy wait? eg:

private void spin(long now) {
  long end = now  +1000;
  while (System.currentTimeMillis() <= end) {
    Thread.sleep(Math.max(1, end - System.currentTimeMillis()));
  }
}

On 3/4/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Author: scolebourne
> Date: Sat Mar  4 15:24:49 2006
> New Revision: 383224
>
> URL: http://svn.apache.org/viewcvs?rev=383224&view=rev
> Log:
> Allow one second to avoid test failures
>
> Modified:
>     
> jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/filefilter/FileFilterTestCase.java
>
> Modified: 
> jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/filefilter/FileFilterTestCase.java
> URL: 
> http://svn.apache.org/viewcvs/jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/filefilter/FileFilterTestCase.java?rev=383224&r1=383223&r2=383224&view=diff
> ==============================================================================
> --- 
> jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/filefilter/FileFilterTestCase.java
>  (original)
> +++ 
> jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/filefilter/FileFilterTestCase.java
>  Sat Mar  4 15:24:49 2006
> @@ -524,7 +524,7 @@
>      }
>
>      private void spin(long now) {
> -        while (System.currentTimeMillis() <= now);
> +        while (System.currentTimeMillis() <= now + 1000);
>      }
>
>  }
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


--
Sandy McArthur

"He who dares not offend cannot be honest."
- Thomas Paine

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to