42 template <
typename Func,
typename... Args>
43 dthread(
tu unit,
double value, Func&& func, Args&&... args) {
46 std::thread([
this, unit, value, func = std::forward<Func>(func), args = std::make_tuple(std::forward<Args>(args)...)]()
mutable {
48 std::apply(func, args);
62 template <
typename Func,
typename... Args>
63 dthread(
bool noSleep, Func&& func, Args&&... args) {
66 std::thread([
this, func = std::forward<Func>(func), args = std::make_tuple(std::forward<Args>(args)...)]()
mutable {
68 std::apply(func, args);
81 inline void stop() {running=
false;}
93 std::atomic<bool> running{
false};
dthread(bool noSleep, Func &&func, Args &&... args)
スリープなしで連続ループ実行するスレッドを起動するコンストラクタ
~dthread()
デストラクタ。スレッドのループを停止する
void stop()
スレッドのループを手動で停止する
dthread(tu unit, double value, Func &&func, Args &&... args)
一定間隔でループ実行するスレッドを起動するコンストラクタ
void sleepc(tu unit, double value)
指定した時間単位でスレッドをスリープさせる