From e10ff189aca57bba91933088195d4edda199cb20 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 13 Apr 2024 23:14:48 +0200 Subject: Adding upstream version 1.9.3. Signed-off-by: Daniel Baumann --- mplexer.hh | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'mplexer.hh') diff --git a/mplexer.hh b/mplexer.hh index 70b36d2..0fab107 100644 --- a/mplexer.hh +++ b/mplexer.hh @@ -73,8 +73,7 @@ public: FDMultiplexer() : d_inrun(false) {} - virtual ~FDMultiplexer() - {} + virtual ~FDMultiplexer() = default; // The maximum number of events processed in a single run, not the maximum of watched descriptors static constexpr unsigned int s_maxevents = 1024; @@ -106,7 +105,7 @@ public: } /* do the addition _after_ so the entry is not added if there is an error */ - accountingAddFD(d_readCallbacks, fd, toDo, parameter, ttd); + accountingAddFD(d_readCallbacks, fd, std::move(toDo), parameter, ttd); } //! Add an fd to the write watch list - currently an fd can only be on one list at a time! @@ -122,7 +121,7 @@ public: } /* do the addition _after_ so the entry is not added if there is an error */ - accountingAddFD(d_writeCallbacks, fd, toDo, parameter, ttd); + accountingAddFD(d_writeCallbacks, fd, std::move(toDo), parameter, ttd); } //! Remove an fd from the read watch list. You can't call this function on an fd that is closed already! @@ -185,14 +184,14 @@ public: { accountingRemoveFD(d_writeCallbacks, fd); this->alterFD(fd, EventKind::Write, EventKind::Read); - accountingAddFD(d_readCallbacks, fd, toDo, parameter, ttd); + accountingAddFD(d_readCallbacks, fd, std::move(toDo), parameter, ttd); } void alterFDToWrite(int fd, callbackfunc_t toDo, const funcparam_t& parameter = funcparam_t(), const struct timeval* ttd = nullptr) { accountingRemoveFD(d_readCallbacks, fd); this->alterFD(fd, EventKind::Read, EventKind::Write); - accountingAddFD(d_writeCallbacks, fd, toDo, parameter, ttd); + accountingAddFD(d_writeCallbacks, fd, std::move(toDo), parameter, ttd); } std::vector> getTimeouts(const struct timeval& tv, bool writes = false) @@ -282,7 +281,7 @@ protected: { Callback cb; cb.d_fd = fd; - cb.d_callback = toDo; + cb.d_callback = std::move(toDo); cb.d_parameter = parameter; memset(&cb.d_ttd, 0, sizeof(cb.d_ttd)); if (ttd) { -- cgit v1.2.3