修飾子とタイプ | クラスと説明 |
---|---|
static class |
hiThread.CanceledException
キャンセル例外
|
static class |
hiThread.IntThread |
Thread.State, Thread.UncaughtExceptionHandler
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
コンストラクタと説明 |
---|
hiThread() |
修飾子とタイプ | メソッドと説明 |
---|---|
void |
cancel()
動作中のI/Oをキャンセルする.
|
void |
cancel(boolean disable_after_)
動作中のI/Oをキャンセルする.
|
void |
check()
canel状態の場合Canceled例外をthrowする.
|
int |
doIt(hiThread.IntThread th_) |
void |
doThis(hiU.RunnableEx<Exception> run_)
別スレッドで同期的に動作させる.
|
void |
doThis(String comment_,
hiU.RunnableEx<Exception> run_) |
boolean |
isCanceled()
cancel状態か.
|
void |
reset()
動作要求を受け付けるようにします.
|
static void |
sleep(long millis_)
指定ミリ秒スリープする(throws Exception無し)
例外はhiExceptionでラップされます。
|
static void |
sleep(long millis_,
int nanos_)
指定ナノ秒スリープする(throws Exception無し)
例外はhiExceptionでラップされます。
|
static Thread |
start(Runnable func_)
ラムダ式をスレッドで実行する.
|
static Thread |
start(Runnable func_,
String name_)
ラムダ式をスレッドで実行する.
|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, run, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, start, stop, stop, suspend, toString, yield
public int doIt(hiThread.IntThread th_)
public void doThis(hiU.RunnableEx<Exception> run_)
別スレッドで同期的に動作させます。
キャンセル可能です。
hiRef.V1<Integer> _result= new hiRef.V1<>(); hiThread _th = new hiThread(); _th.doThis(()->{ _result.value= someFunctionRestunsInteger(); }); System.out.println("result = "+_result.value);
run_
- 実行する機能public void doThis(String comment_, hiU.RunnableEx<Exception> run_)
public void cancel(boolean disable_after_)
動作中のI/O全てをキャンセルします。
disable_after_
- hiIO.reset()
が呼ばれるまで動作要求を受け付けません。public void cancel()
動作中のI/O全てをキャンセルします。 hiIO.cancel(false)と同じです。
public void reset()
public boolean isCanceled()
public void check()
hiThread.CanceledException
- キャンセル状態public static void sleep(long millis_)
millis_
- ミリ秒public static void sleep(long millis_, int nanos_)
millis_
- ミリ秒nanos_
- ナノ秒public static Thread start(Runnable func_)
次の様にラムダ式をスレッドで実行することができます。
void my_thread_func(){ while(true){ //... } } //... hiThread.start(()->{user_thread_func();});
func_
- ラムダ式