cppnet
C++ network utilities for asynchronous servers.
Loading...
Searching...
No Matches
interrupt.hpp
Go to the documentation of this file.
1// Copyright 2025 Kevin Exton
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
18#pragma once
19#ifndef CPPNET_INTERRUPT_HPP
20#define CPPNET_INTERRUPT_HPP
21#include "net/detail/concepts.hpp"
22
23#include <io/io.hpp>
25namespace net::timers {
29 using socket_type = io::socket::native_socket_type;
31 static constexpr auto INVALID_SOCKET = io::socket::INVALID_SOCKET;
33 std::array<socket_type, 2> sockets{INVALID_SOCKET, INVALID_SOCKET};
39 inline auto interrupt() const noexcept -> void;
40};
41
48template <InterruptSource Source> struct interrupt : public Source {
50 using interrupt_source_t = Source;
52 inline auto operator()() const noexcept -> void;
53};
54
55} // namespace net::timers
56
57#include "impl/interrupt_impl.hpp" // IWYU pragma: export
58
59#endif // CPPNET_INTERRUPT_HPP
This namespace is for timers and interrupts.
Definition interrupt.hpp:25
An interrupt is an immediately run timer event.
Definition interrupt.hpp:48
auto operator()() const noexcept -> void
Calls the underlying interrupt.
Source interrupt_source_t
The underlying interrupt source type.
Definition interrupt.hpp:50
A socketpair interrupt source.
Definition interrupt.hpp:27
static constexpr auto INVALID_SOCKET
The invalid socket constant.
Definition interrupt.hpp:31
auto interrupt() const noexcept -> void
The interrupt method.
std::array< socket_type, 2 > sockets
The socket pair.
Definition interrupt.hpp:33
io::socket::native_socket_type socket_type
The native socket type.
Definition interrupt.hpp:29