//
// Created by WJG on 2021-11-3.
//

#ifndef SMARTPANEL_COSS_SCENETHREADPOOL_H
#define SMARTPANEL_COSS_SCENETHREADPOOL_H

#include <list>
#include <mutex>
#include <condition_variable>
#include "json/json.h"

class SceneThreadPool {
public:
    int thread_num;
    int quit;
    std::mutex msg_ListMutex;
    std::mutex msg_ReadyMutex;
    std::condition_variable msg_ReadyCond;
    std::list<Json::Value> msg_List;
    bool is_cancel;

    explicit SceneThreadPool(int num);
    ~SceneThreadPool();
    int putMsg(const Json::Value& value);
    int putMsgFirst(const Json::Value& value);
    int clearMsgList();
    int cancelMsg();
    void stopThread();

private:
    void intiThreadPool();

};

#endif //SMARTPANEL_COSS_SCENETHREADPOOL_H
