#include "vector.hpp"
#include "workers.hpp"

#include <atomic>
#include <ranges>
#include <thread>
#include <vector>

int main() {
  th_safe::vector<std::string> news;
  std::atomic_bool done = false;

  std::jthread writer_thread([&] {
    workers::writer(news, 10);
    done = true;
  });

  std::vector<std::jthread> readers;
  for (std::int32_t id : std::views::iota(1, 4)) {
    readers.emplace_back(workers::reader, std::cref(news), std::ref(done), id);
  }
}
