fix
Some checks failed
rpcrypto-build / build (Debug, himix200.toolchain.cmake) (push) Failing after 1m2s
rpcrypto-build / build (Debug, hisiv510.toolchain.cmake) (push) Failing after 1m0s
linux-mips64-gcc / linux-gcc-mips64el (push) Has been cancelled
linux-x64-gcc / linux-gcc (push) Has been cancelled
linux-hisiv500-gcc / linux-gcc-hisiv500 (push) Has been cancelled
rpcrypto-build / build (Release, hisiv510.toolchain.cmake) (push) Has been cancelled
rpcrypto-build / build (Release, himix200.toolchain.cmake) (push) Has been cancelled

This commit is contained in:
tqcq 2024-01-19 11:03:48 +08:00
parent d54ffda993
commit 377613c9ba

View File

@ -18,9 +18,9 @@ class ProtectedEventStream : public EventStream
using Callback = std::function<CallbackReturn(const Event&, ExtraArgTypes...)>; using Callback = std::function<CallbackReturn(const Event&, ExtraArgTypes...)>;
public: public:
void postpone(std::any event) override void postpone(nonstd::any event) override
{ {
auto myEvent = std::any_cast<Event>(event); auto myEvent = nonstd::any_cast<Event>(event);
std::lock_guard writeGuard{_mutexEvent}; std::lock_guard writeGuard{_mutexEvent};
_queue.push_back(std::move(myEvent)); _queue.push_back(std::move(myEvent));
} }
@ -67,10 +67,10 @@ public:
return processEvents.size(); return processEvents.size();
} }
bool addListener(const std::uint32_t listenerID, std::any callback) override bool addListener(const std::uint32_t listenerID, nonstd::any callback) override
{ {
std::lock_guard writeGuard{_mutexCallbacks}; std::lock_guard writeGuard{_mutexCallbacks};
auto myCallback = std::any_cast<Callback>(callback); auto myCallback = nonstd::any_cast<Callback>(callback);
if(_isProcessing) if(_isProcessing)
{ {
_waiting.emplace_back(listenerID, std::move(myCallback)); _waiting.emplace_back(listenerID, std::move(myCallback));