9#include <yaclib_std/condition_variable>
10#include <yaclib_std/mutex>
11#include <yaclib_std/thread>
24 Type Tag()
const noexcept final;
26 bool Alive()
const noexcept final;
44 [[
nodiscard]]
bool WasStop()
const noexcept;
45 [[
nodiscard]]
bool WantStop()
const noexcept;
46 [[
nodiscard]]
bool NoJobs()
const noexcept;
48 void Stop(std::unique_lock<yaclib_std::mutex>&& lock)
noexcept;
50 std::vector<yaclib_std::thread> _workers;
54 std::uint64_t _jobs_count;
TODO(kononovk) Doxygen docs.
void Submit(Job &task) noexcept final
Submit given job.
bool Alive() const noexcept final
Return true if executor still alive, that means job passed to submit will be Call.
Type Tag() const noexcept final
Return type of this executor.
~FairThreadPool() noexcept override
void Wait() noexcept
TODO(kononovk) Rename to Join.
A intrusive pointer to objects with an embedded reference count.
Callable that can be executed in an IExecutor.
std::condition_variable condition_variable
IntrusivePtr< FairThreadPool > MakeFairThreadPool(std::uint64_t threads=yaclib_std::thread::hardware_concurrency())
Contract< V, E > MakeContract()
Creates related future and promise.