@@ -39,15 +39,8 @@ class ListenerSet{
3939 bool try_add (ListenerType& listener);
4040 bool try_remove (ListenerType& listener);
4141
42- template <typename Lambda>
43- void run_lambda_unique (Lambda&& lambda);
44- template <typename Lambda>
45- void run_lambda_with_duplicates (Lambda&& lambda);
46-
47- template <typename Function, class ... Args>
48- void run_method_unique (Function function, Args&&... args);
4942 template <typename Function, class ... Args>
50- void run_method_with_duplicates (Function function, Args&&... args);
43+ void run_method (Function function, Args&&... args);
5144
5245private:
5346 // Optimization. Keep an atomic version of the count. This will let us
@@ -133,47 +126,9 @@ bool ListenerSet<ListenerType>::try_remove(ListenerType& listener){
133126
134127
135128
136- template <typename ListenerType>
137- template <typename Lambda>
138- void ListenerSet<ListenerType>::run_lambda_unique(Lambda&& lambda){
139- #ifdef PA_DEBUG_ListenerSet
140- auto scope = m_sanitizer.check_scope ();
141- #endif
142- if (empty ()){
143- return ;
144- }
145- ReadSpinLock lg (m_lock);
146- for (auto & item : m_listeners){
147- lambda (*item.first );
148- }
149- }
150-
151-
152-
153- template <typename ListenerType>
154- template <typename Lambda>
155- void ListenerSet<ListenerType>::run_lambda_with_duplicates(Lambda&& lambda){
156- #ifdef PA_DEBUG_ListenerSet
157- auto scope = m_sanitizer.check_scope ();
158- #endif
159- if (empty ()){
160- return ;
161- }
162- ReadSpinLock lg (m_lock);
163- for (auto & item : m_listeners){
164- ListenerType& listener = *item.first ;
165- size_t count = item.second ;
166- do {
167- lambda (listener);
168- }while (--count);
169- }
170- }
171-
172-
173-
174129template <typename ListenerType>
175130template <typename Function, class ... Args>
176- void ListenerSet<ListenerType>::run_method_unique (Function function, Args&&... args){
131+ void ListenerSet<ListenerType>::run_method (Function function, Args&&... args){
177132#ifdef PA_DEBUG_ListenerSet
178133 auto scope = m_sanitizer.check_scope ();
179134#endif
@@ -188,27 +143,6 @@ void ListenerSet<ListenerType>::run_method_unique(Function function, Args&&... a
188143
189144
190145
191- template <typename ListenerType>
192- template <typename Function, class ... Args>
193- void ListenerSet<ListenerType>::run_method_with_duplicates(Function function, Args&&... args){
194- #ifdef PA_DEBUG_ListenerSet
195- auto scope = m_sanitizer.check_scope ();
196- #endif
197- if (empty ()){
198- return ;
199- }
200- ReadSpinLock lg (m_lock);
201- for (auto & item : m_listeners){
202- ListenerType& listener = *item.first ;
203- size_t count = item.second ;
204- do {
205- (listener.*function)(std::forward<Args>(args)...);
206- }while (--count);
207- }
208- }
209-
210-
211-
212146
213147
214148
0 commit comments