first commit: echo server
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* PauseMask.hpp :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: acossari <acossari@student.codam.nl> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2026/08/25 20:00:34 by acossari #+# #+# */
|
||||
/* Updated: 2026/08/25 20:00:38 by acossari ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace webserv {
|
||||
|
||||
// PauseMask stores its flags in an 8-bit integer. Using the same type here
|
||||
// makes the compiler reject a ninth flag, which would not fit in the mask.
|
||||
enum class ListenerPause : std::uint8_t {
|
||||
PoolFull = 1U << 0,
|
||||
AcceptBackoff = 1U << 1,
|
||||
};
|
||||
|
||||
class PauseMask final {
|
||||
public:
|
||||
// set() returns true when the first reason is added; clear() returns true
|
||||
// when the last is removed. Those transitions disarm and rearm listeners.
|
||||
[[nodiscard]] bool set(ListenerPause reason);
|
||||
[[nodiscard]] bool clear(ListenerPause reason);
|
||||
|
||||
private:
|
||||
std::uint8_t bits_ = 0;
|
||||
};
|
||||
|
||||
} // namespace webserv
|
||||
Reference in New Issue
Block a user