added net module
This commit is contained in:
@@ -16,14 +16,13 @@ namespace matador::utils {
|
||||
* This thread pool class implements the
|
||||
* leader follower pattern.
|
||||
*/
|
||||
class leader_follower_thread_pool
|
||||
{
|
||||
private:
|
||||
leader_follower_thread_pool(const leader_follower_thread_pool &);
|
||||
|
||||
leader_follower_thread_pool &operator=(const leader_follower_thread_pool &);
|
||||
|
||||
class leader_follower_thread_pool {
|
||||
public:
|
||||
leader_follower_thread_pool(const leader_follower_thread_pool&) = delete;
|
||||
leader_follower_thread_pool& operator=(const leader_follower_thread_pool&) = delete;
|
||||
leader_follower_thread_pool(leader_follower_thread_pool&&) = delete;
|
||||
leader_follower_thread_pool& operator=(leader_follower_thread_pool&&) = delete;
|
||||
|
||||
/**
|
||||
* Creates a new leader follower thread pool instance
|
||||
* with the given thread pool size and given join
|
||||
@@ -34,7 +33,7 @@ public:
|
||||
* @param join_func Join function.
|
||||
*/
|
||||
template<typename F>
|
||||
leader_follower_thread_pool(std::size_t size, F join_func)
|
||||
leader_follower_thread_pool(const std::size_t size, F join_func)
|
||||
: num_threads_(size), join_(join_func)
|
||||
, follower_(size) {}
|
||||
|
||||
@@ -60,7 +59,7 @@ public:
|
||||
*
|
||||
* @return Number of threads.
|
||||
*/
|
||||
std::size_t size() const;
|
||||
[[nodiscard]] std::size_t size() const;
|
||||
|
||||
/**
|
||||
* Shuts the thread pool down.
|
||||
@@ -81,14 +80,14 @@ public:
|
||||
*
|
||||
* @return Number of follower threads.
|
||||
*/
|
||||
std::size_t num_follower() const;
|
||||
[[nodiscard]] std::size_t num_follower() const;
|
||||
|
||||
/**
|
||||
* Returns true if the thread pool is running.
|
||||
*
|
||||
* @return True if thread pool is running.
|
||||
*/
|
||||
bool is_running() const;
|
||||
[[nodiscard]] bool is_running() const;
|
||||
|
||||
private:
|
||||
/*
|
||||
|
||||
@@ -41,7 +41,7 @@ template <>
|
||||
struct std::hash<matador::utils::uuid> {
|
||||
std::size_t operator()(const matador::utils::uuid& u) const noexcept {
|
||||
std::size_t h = 0;
|
||||
for (uint32_t val : u.data()) {
|
||||
for (const uint32_t val : u.data()) {
|
||||
h ^= std::hash<uint32_t>{}(val) + 0x9e3779b9 + (h << 6) + (h >> 2);
|
||||
}
|
||||
return h;
|
||||
|
||||
Reference in New Issue
Block a user