//
// Created by WJG on 2020-5-12.
//

#ifndef MGCORE_CTHREADPOOL_H
#define MGCORE_CTHREADPOOL_H

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

class CThreadPool {
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;

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

private:
    void intiThreadPool();

};


#endif //MGCORE_CTHREADPOOL_H
