--- nono/vm/scheduler.h 2026/04/29 17:04:28 1.1.1.1 +++ nono/vm/scheduler.h 2026/04/29 17:04:32 1.1.1.2 @@ -48,7 +48,7 @@ class Scheduler : public Device // スレッド開始 void ThreadRun(); - // スレッド終了指示 + // スレッド終了 void Terminate(); // スケジューラを開始 (電源オン時に vm から呼ばれる) @@ -82,10 +82,10 @@ class Scheduler : public Device // true なら高速モード、false なら同期モード。 void SetFullSpeed(bool enable); - // イベントを登録する - void AddEvent(Event *newev); - // イベントを削除する - void DelEvent(Event *event); + // イベントを開始する + void StartEvent(Event *newev); + // イベントを停止する + void StopEvent(Event *event); std::list eventlist {}; // 有効なイベントリスト std::mutex evcs {}; // イベントリストのロック @@ -99,6 +99,9 @@ class Scheduler : public Device std::mutex cvmtx {}; private: + pthread_t thread {}; + bool thread_created = false; // スレッドが作成されたら true + // スケジューラの動作モード。SCHED_* uint32 mode = 0; @@ -112,7 +115,7 @@ class Scheduler : public Device uint64 rtc_last_clock = 0; }; -extern Scheduler *gScheduler; +extern std::unique_ptr gScheduler; // 現在時刻 [nsec] を取得する static inline uint64 GetRealTime()