#pragma once

#include <thread>
#include <memory>
#include <queue>
#include <condition_variable>
#include <mutex>

#include "Core/Core.h"


class RHICommonList : public std::enable_shared_from_this<RHICommonList> {
public:
    using Ptr = std::shared_ptr<RHICommonList>;
    static Ptr Create();

public:
    ~RHICommonList();

    bool Start();
    void Stop();

    void Push(class RHICommond* commond);

private:
    explicit RHICommonList() noexcept;

private:
    std::unique_ptr<std::thread> thread_;
    bool isRunning_{ false };

    std::mutex queueMutex_;
    std::condition_variable queueCondVar_;
    std::queue<SharedPtr<class RHICommond>> queue_;
};