All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.nustaq.fastcast.util.Sleeper Maven / Gradle / Ivy

The newest version!
/**
 * Copyright (c) 2014, Ruediger Moeller. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 * MA 02110-1301  USA
 *
 * Date: 03.01.14
 * Time: 21:19
 * To change this template use File | Settings | File Templates.
 */
package org.nustaq.fastcast.util;

/**
 * Created with IntelliJ IDEA.
 * User: moelrue
 * Date: 8/12/13
 * Time: 2:28 PM
 */
public class Sleeper {

    public static void spinMicros(int micro) {
        if ( micro <= 0 )
            return;
        long now = System.nanoTime();
        while( System.nanoTime()-now < micro*1000 ) {
            // spin
        }
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy