--- nono/vm/scheduler.h 2026/04/29 17:04:53 1.1.1.8 +++ nono/vm/scheduler.h 2026/04/29 17:04:56 1.1.1.9 @@ -10,6 +10,7 @@ #include "event.h" #include "eventqueue.h" #include "fixedqueue.h" +#include "monitor.h" #include "mpu.h" #include "statistics.h" #include "stopwatch.h" @@ -79,15 +80,18 @@ class Scheduler : public Device bool Init() override; - nnSize GetMonitorSize() override; - void MonitorUpdate(TextScreen&) override; - // スレッド開始 void ThreadRun(); // スレッド終了 void Terminate(); + // スレッド終了を待機する + void Wait(); + + // スレッド終了を指示する + void RequestExit(); + // 電源オン要求 // 当然電源オフ時に呼ぶので VM スレッド外から呼ばれることになる。 void RequestPowerOn() { @@ -151,6 +155,8 @@ class Scheduler : public Device // 同期イベント void SyncCallback(Event& ev); + DECLARE_MONITOR_CALLBACK(MonitorUpdate); + // メインループ bool RunOff(); bool RunOn(); @@ -164,9 +170,6 @@ class Scheduler : public Device // REQ_* フラグのデバッグ表示 void PutlogReqFlag(uint32 req) const; - // スレッド終了を指示する - void RequestExit(); - pthread_t thread {}; bool thread_created {}; // スレッドが作成されたら true @@ -221,12 +224,16 @@ class Scheduler : public Device Statistics last_event_stat {}; // 直近実1秒のイベント統計 // 同期イベント - Event sync_event {}; + Event sync_event { this }; + + Monitor monitor { this }; // 電源オフを UI に通知するためのコールバック void (*poweroff_callback)() {}; }; +extern const std::string TimeToStr(uint64 t); + extern Stopwatch gRealtime; extern std::unique_ptr gScheduler;