#pragma once
#include <trantor/net/EventLoopThread.h>
#include <trantor/exports.h>
#include <vector>
#include <memory>
#include <atomic>
namespace trantor
{
class TRANTOR_EXPORT EventLoopThreadPool : NonCopyable
{
  public:
    EventLoopThreadPool() = delete;
    EventLoopThreadPool(size_t threadNum,
                        const std::string &name = "EventLoopThreadPool");
    void start();
    void wait();
    size_t size()
    {
        return loopThreadVector_.size();
    }
    EventLoop *getNextLoop();
    EventLoop *getLoop(size_t id);
    std::vector<EventLoop *> getLoops() const;
  private:
    std::vector<std::shared_ptr<EventLoopThread>> loopThreadVector_;
    std::atomic<size_t> loopIndex_{0};
};
}  