Commit Graph

513 Commits

Author SHA1 Message Date
Max Kellermann f807345022 event/Loop: use std::chrono::ceil()
Thanks to C++17, we don't need our custom implementation anymore.
2024-10-30 21:29:16 +01:00
Max Kellermann bbbbf5f4bd event/MultiSocketMonitor: reschedule epoll/EPERM workaround forever
Fixes a regression by commit 3558317dc9 which caused the ALSA null
plugin to cease to work because the workaround timer was never rescheduled.
2024-07-25 20:16:53 +02:00
Max Kellermann 3558317dc9 event/MultiSocketMonitor: remove force-refresh on every iteration
libasound guarantees that the file descriptors never change for a
"prepared" PCM device, thus we can omit this defensive kludge.
2024-07-23 15:08:55 +02:00
Max Kellermann 4c4a3c8664 event/TimerList: use FineTimerEvent::GetDue()
Avoid accessing the private field from an inner class of the friend
class, because some compilers apparently don't like it (Apple clang).
2024-07-23 13:38:05 +02:00
Max Kellermann 9aa6b03ba8 event/MultiSocketMonitor: pass std::span to ReplaceSocketList() 2024-07-11 21:09:27 +02:00
Max Kellermann 45f92f0ef0 event/MultiSocketMonitor: fix lambda indent 2024-07-11 21:06:33 +02:00
Max Kellermann 23a3278b4e event/MultiSocketMonitor: make ctor protected and explicit 2024-07-11 21:05:11 +02:00
Max Kellermann abb23ba894 event/EpollEvents: add mapping for EPOLLPRI 2024-06-25 20:28:34 +02:00
Max Kellermann 4fc3230fe6 event/Loop: use std::scoped_lock with implicit template parameter 2024-05-23 20:44:12 +02:00
Max Kellermann 4d3adaa557 event/SocketEvent: erase IMPLICIT_FLAGS in Cancel{Read,Write}()
Without this, calling CancelRead() after ScheduleRead() would leave
the HANGUP scheduled, and the caller could receive HANGUP events over
and over which are never properly handled, leading to a busy loop.

The semantics of this API are hard to get right, because the
IMPLICIT_FLAGS (a property of epoll) are somewhat weird.  But it seems
that this change repairs a side effect of the SocketEvent interface
that seemed counterintuitive.
2024-05-06 12:48:42 +02:00
Max Kellermann 1e4bf90c60 io, net, evnet: quote file names in error messages 2024-04-10 13:36:05 +02:00
Max Kellermann 1ee25b4234 event/TimerList: remove option NO_BOOST
Always use the new IntrusiveTreeSet class.
2024-04-03 21:30:59 +02:00
Max Kellermann c5e607a310 event/TimerList: use IntrusiveTreeSet instead of boost::intrusive::multiset 2024-04-03 21:30:31 +02:00
Max Kellermann c94c08c6b4 event/BufferedSocket: pass std::span to OnSocketInput() 2024-04-03 20:43:40 +02:00
Max Kellermann b9daeef524 event/FineTimerEvent: add SetDue(), ScheduleCurrent() 2023-11-21 20:47:29 +01:00
Max Kellermann 9383ceac30 event/{Coarse,Fine}TimerEvent: add API docs 2023-11-21 20:47:25 +01:00
Max Kellermann 73708e7be7 event/TimerEvent: remove transitional header 2023-11-21 20:41:55 +01:00
Max Kellermann 57d9cffc42 event/PipeEvent: expose the EventPollBackendEvents constants 2023-11-02 10:48:21 +01:00
Max Kellermann 7c0b561a16 event/InotifyEvent: add method TryAddWatch() 2023-10-15 10:51:06 +02:00
Max Kellermann 491cc8f54d net/SocketDescriptor: add {Read,Write}NoWait()
It was surprising that Read() was non-blocking, but there was no
blocking version of it.  Let's make the non-blocking behavior explicit
and change Read() to be blocking.

In order to find existing callers easily with compiler errors, this
also refactors Read()/Write() to take a std::span parameter.
2023-09-27 11:39:55 +02:00
Max Kellermann cad35a83fb io/FileDescriptor: add Read()/Write() overloads with std::span 2023-09-27 11:14:23 +02:00
Max Kellermann 21590e60e6 event/FullyBufferedSocket: pass std::span to DirectWrite() 2023-09-27 10:36:56 +02:00
Max Kellermann fe69ad0861 event/BufferedSocket: pass std::span to DirectRead() 2023-09-27 10:34:50 +02:00
Max Kellermann 9daf8f6de5 event/BufferedSocket: use std::byte 2023-09-27 10:30:09 +02:00
Max Kellermann 1090cc964a event/Loop: relicense to BSD-2
This library has been initially developed at CM4all and eventually
published here:
 https://github.com/CM4all/libcommon/tree/master/src/event/

On this copy of it, there were only minor modifications by people
other than me, and these are below the copyright threshold; only
non-epoll backends (which remain under the GPL) were developed by
somebody else.
2023-09-26 15:47:09 +02:00
Max Kellermann 64647edbe1 lib/fmt/SocketAddressFormatter: new library 2023-09-19 11:22:39 +02:00
Max Kellermann 3d69f43cff event/Loop: include SocketEvent.hxx only if HAVE_THREADED_EVENT_LOOP 2023-09-16 22:55:04 +02:00
Max Kellermann 41b1931d91 event/Loop: move the poll_backend to the top
This is where all sockets are registered, so it should be initialized
first and destructed last.
2023-09-16 22:45:45 +02:00
Max Kellermann 26577d1301 io/uring/Queue: make Submit() virtual, Push() not
This allows submitting io_uring calls without an `Operation` instance
(fire & forget).  We'll do that for close().
2023-05-22 21:57:18 +02:00
Max Kellermann 9027e5c5bb release v0.23.13
-----BEGIN PGP SIGNATURE-----
 
 iQJBBAABCgArFiEEA5IzWngIOJSkMBxDI26KWMbbRRIFAmRrqn4NHG1heEBibGFy
 Zy5kZQAKCRAjbopYxttFErXiD/9QIaeO5d+U7BJK1yGkQgu5vHo4Pm34ewP8LTxs
 K2MYxQQ2jZc7PXqi5Z04wmUw8ymq1BVA2D0ytMdl1Ejcbrste7UrP+1TuD8L9JBj
 WCE+4otNVYDpx1PB32BN+gxCmJqiFtAQS+eMIz/SXdEXZ9sJvIgYRRkSiSFd0WHM
 dT3OeeZ0V8cANbXpgI+RLghRGkVdpZJo4uXh3c0OHog1fjEBWPw6+7tH/mkotM0n
 /hQjI5j14wnzZuIpkDR1kuzvGYmxJKG6LkuUqcm1WexNFbxMqDSbAlXeCmzJn7eK
 NQvtROOGNjQ84thxRPLlDlYa6vbxoTqdYgZsVHzsQZWejhqw8zsPsF+Ea0A4tkLd
 UKDQFTphZMVqx74+1u7IjQyW7x+k02iXWLwH2IheEl+BJhvEB7zEflN9TR81jek4
 RrGx7jcTArdpt7okAe2ONkHvTYtIpaK5E2voza8K4TGOMzpkVlOkyvJ+rpn8CDRf
 w0faVvmCQdSrgHKfwUUY8Z47a7d+kkKpFLlvvzNoDV8drQXfgIj5t9HOLATSVVux
 l2pbgauXFsKyd4IsByXj+m8cBSvmy2C4eLJCsmguiZEvcobdJtzwOr4KuwQDjBsC
 8HW0BD0t9S1dSL59vJdMG+CfK/QU5rmAIkxdydD42uo9UmSS78xw1uQgi9oDaPa8
 XNCGdQ==
 =nOGh
 -----END PGP SIGNATURE-----

Merge tag 'v0.23.13'

release v0.23.13
2023-05-22 19:52:08 +02:00
Max Kellermann 740cbe9e02 event/Loop: remove failing assert()
The `assert(!quit)` can fail if the `EventThread` gets stopped before
it enters `EventLoop::Run()`. There is a similar problem with `alive`,
which gets reset by `EventThread::Stop()`.

If that happens, then `EventLoop::Run()` should return immediately
without handling any events.
2023-05-22 18:14:25 +02:00
Max Kellermann 76497bd5f7 util/IntrusiveSortedList, event/TimerList: include cleanup 2023-04-06 10:24:53 +02:00
Max Kellermann 7a5f485cf8 event/ServerSocket: use class UniqueSocketDescriptor in SupportsIPv6() 2023-03-29 10:06:48 +02:00
Max Kellermann 6f7c7a2149 event/EpollBackend: add missing header guard 2023-03-21 11:00:41 +01:00
Max Kellermann a20d467bf1 event/Loop: move quit_injected check to inside `#ifdef HAVE_THREADED_EVENT_LOOP` 2023-03-20 15:02:32 +01:00
Max Kellermann 3e2bff296f event/SocketEvent: add method GetReadyFlags() 2023-03-12 20:12:15 +01:00
Max Kellermann cf01db4d08 event/Chrono, ...: relicense to BSD-2 2023-03-12 20:02:54 +01:00
Max Kellermann 08dbb4a69a event/BackendEvents: relicense to BSD-2
These headers contain only trivial integer constants and these are
probably not even copyrightable.
2023-03-12 19:53:03 +01:00
Max Kellermann 63b9fb3d2b event/meson.build: add missing dependency on libio.a 2023-03-09 18:27:05 +01:00
Max Kellermann 42f6a0441c use [[gnu::...]] attributes 2023-03-06 16:14:15 +01:00
Max Kellermann 148aca23be use SPDX IDs, replacing the long copyright headers 2023-03-06 14:59:48 +01:00
Max Kellermann 02f5698868 event/Loop: remove unnecessary include
Not used since a3b32819b1
2023-01-31 13:04:25 +01:00
Max Kellermann def6fffcf1 event/Loop: fixup for NO_FINE_TIMER_EVENT 2023-01-29 08:07:03 +01:00
Max Kellermann 7ef0bfbdf1 event/meson.build: disable Boost 2023-01-23 14:58:38 +01:00
Max Kellermann 74976d3199 event: make FineTimerEvent optional
Several applications don't need it, so let's eliminate the code from
the executable.
2023-01-22 12:21:46 +01:00
Max Kellermann a750e4afa7 event/Loop: move code to GetEarlierTimeout() 2023-01-22 12:19:07 +01:00
Max Kellermann fa58db798b lib/fmt/RuntimeError: new library
Replacing FormatRuntimeError().
2022-11-29 14:10:34 +01:00
Max Kellermann 66029c405f system/FmtError: move to lib/fmt/ 2022-11-28 23:09:27 +01:00
Max Kellermann 96ae659fdf system/FmtError: new library
Replaces the Format*() functions in system/Error.hxx.
2022-11-28 21:56:12 +01:00
Max Kellermann a3b32819b1 event/Loop: split InjectBreak() from Break() 2022-11-22 22:30:12 +01:00