threadlib.java

来自「CroftSoft Code Library是一个开源的可移植的纯Java游戏库」· Java 代码 · 共 41 行

JAVA
41
字号
     package com.croftsoft.core.lang;

     /*********************************************************************
     * A collection of static methods to manipulate Thread objects.
     *
     * @version
     *   1999-10-02
     * @author
     *   <A HREF="http://www.alumni.caltech.edu/~croft/">David W. Croft</A>
     *********************************************************************/

     public class  ThreadLib
     //////////////////////////////////////////////////////////////////////
     //////////////////////////////////////////////////////////////////////
     {

     /*********************************************************************
     * Puts the current Thread to sleep for a number of milliseconds.
     *
     * @return
     *   Returns false if InterruptedException was thrown.
     *********************************************************************/
     public static boolean  sleep ( long  millis )
     //////////////////////////////////////////////////////////////////////
     {
       try
       {
         Thread.currentThread ( ).sleep ( millis );
       }
       catch ( InterruptedException  ex )
       {
         return false;
       }

       return true;
     }

     //////////////////////////////////////////////////////////////////////
     //////////////////////////////////////////////////////////////////////
     }

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?