--- nono/vm/ethernet.h 2026/04/29 17:04:35 1.1.1.3 +++ nono/vm/ethernet.h 2026/04/29 17:04:44 1.1.1.5 @@ -72,11 +72,14 @@ class EthernetDevice : public IODevice protected: EthernetDevice(); public: - ~EthernetDevice() override; + virtual ~EthernetDevice() override; bool Create() override; bool Init() override; + // ワーカスレッド + virtual void ThreadRun() = 0; + // パケットを受信した。 // ホストネットワークドライバから呼ばれる。 // ホストネットワークスレッドで mtx 取得状態で呼ばれるので、 @@ -87,7 +90,7 @@ class EthernetDevice : public IODevice // パケット受信許可。 // true の場合のみホストドライバは RecvPacket() をコールしてよい。 - bool RecvEnabled = false; + bool RecvEnabled {}; // MAC アドレスを取得 macaddr_t GetMacAddr() const { @@ -101,7 +104,7 @@ class EthernetDevice : public IODevice // ワーカスレッドへ指示を出すための条件変数 std::condition_variable cv {}; // ワーカスレッドへのリクエストフラグ - uint32 request = 0; + uint32 request {}; protected: // MAC アドレスを生成する @@ -114,7 +117,7 @@ class EthernetDevice : public IODevice bool SendPacket(const std::vector& buf); // MAC アドレス - macaddr_t macaddr; + macaddr_t macaddr {}; }; extern std::unique_ptr gEthernet;