fix event_bus_test
All checks were successful
linux-aarch64-cpu-gcc / linux-gcc-aarch64 (push) Successful in 1m24s
linux-mips64-gcc / linux-gcc-mips64el (Release) (push) Successful in 1m37s
linux-x64-gcc / linux-gcc (Release) (push) Successful in 1m35s
linux-arm-gcc / linux-gcc-armhf (push) Successful in 1m50s
linux-x64-gcc / linux-gcc (Debug) (push) Successful in 2m36s
linux-mips64-gcc / linux-gcc-mips64el (Debug) (push) Successful in 3m23s

This commit is contained in:
tqcq 2024-04-03 18:04:14 +08:00
parent 35e01dccd2
commit bf1584c750
2 changed files with 3 additions and 1 deletions

View File

@ -148,6 +148,8 @@ public:
} }
} }
EventBus *operator->() { return this; }
private: private:
sled::Mutex mutex_; sled::Mutex mutex_;
std::unordered_map<std::type_index, std::function<void(EventBus *)>> cleanup_handlers_ GUARDED_BY(mutex_); std::unordered_map<std::type_index, std::function<void(EventBus *)>> cleanup_handlers_ GUARDED_BY(mutex_);

View File

@ -89,7 +89,7 @@ TEST_SUITE("EventBus")
std::atomic<int> &data; std::atomic<int> &data;
}; };
struct AotmicEventSubscriber : public sled::EventBus::Subscriber { struct AotmicEventSubscriber : public sled::EventBus::Subscriber<> {
virtual ~AotmicEventSubscriber() = default; virtual ~AotmicEventSubscriber() = default;
void OnEvent(AtomicEvent event) { event.data.fetch_add(1); } void OnEvent(AtomicEvent event) { event.data.fetch_add(1); }