Skip to content

Commit accae07

Browse files
committed
Code Cleanup
1 parent ab169af commit accae07

1 file changed

Lines changed: 18 additions & 4 deletions

File tree

src/main/java/the/bytecode/club/bytecodeviewer/util/MiscUtils.java

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
import java.io.InputStream;
1010
import java.io.InputStreamReader;
1111
import java.lang.reflect.Field;
12-
import java.nio.charset.CharsetEncoder;
13-
import java.nio.charset.StandardCharsets;
1412
import java.util.ArrayList;
1513
import java.util.HashSet;
1614
import java.util.List;
@@ -293,10 +291,26 @@ public static void setLanguage(Language language)
293291
}
294292
}
295293

296-
public static Thread startNewThread(String threadName, Runnable threadRunnable)
294+
/**
295+
* START's a new thread (Creates a new thread and runs that thread runnable on it)
296+
*/
297+
public static Thread createNewThread(String threadName, Runnable threadRunnable)
298+
{
299+
return createNewThread(threadName, false, threadRunnable);
300+
}
301+
302+
/**
303+
* START's a new thread (Creates a new thread and runs that thread runnable on it)
304+
* RUN's a new thread (Just executes the thread runnable on the active thread)
305+
*/
306+
public static Thread createNewThread(String threadName, boolean runDontStart, Runnable threadRunnable)
297307
{
298308
Thread temporaryThread = new Thread(threadRunnable, threadName);
299-
temporaryThread.start();
309+
310+
if(runDontStart)
311+
temporaryThread.run();
312+
else
313+
temporaryThread.start();
300314

301315
return temporaryThread;
302316
}

0 commit comments

Comments
 (0)