Java tutorial
//package com.java2s; //License from project: Open Source License import javax.annotation.Nonnull; public class Main { /** * Check whether a specific thread is running (or able to run) right now. * * @param t the thread to check * @return true is the specified thread is or could be running right now */ static public boolean canThreadRun(@Nonnull Thread t) { Thread.State s = t.getState(); return s.equals(Thread.State.RUNNABLE); } }