| @@ -118,6 +118,8 @@ public: | |||||
| template <typename Callback> | template <typename Callback> | ||||
| void call (Callback&& callback) | void call (Callback&& callback) | ||||
| { | { | ||||
| typename ArrayType::ScopedLockType lock (listeners.getLock()); | |||||
| for (Iterator<DummyBailOutChecker, ThisType> iter (*this); iter.next();) | for (Iterator<DummyBailOutChecker, ThisType> iter (*this); iter.next();) | ||||
| callback (*iter.getListener()); | callback (*iter.getListener()); | ||||
| } | } | ||||
| @@ -128,6 +130,8 @@ public: | |||||
| template <typename Callback> | template <typename Callback> | ||||
| void callExcluding (ListenerClass* listenerToExclude, Callback&& callback) | void callExcluding (ListenerClass* listenerToExclude, Callback&& callback) | ||||
| { | { | ||||
| typename ArrayType::ScopedLockType lock (listeners.getLock()); | |||||
| for (Iterator<DummyBailOutChecker, ThisType> iter (*this); iter.next();) | for (Iterator<DummyBailOutChecker, ThisType> iter (*this); iter.next();) | ||||
| { | { | ||||
| auto* l = iter.getListener(); | auto* l = iter.getListener(); | ||||
| @@ -143,6 +147,8 @@ public: | |||||
| template <typename Callback, typename BailOutCheckerType> | template <typename Callback, typename BailOutCheckerType> | ||||
| void callChecked (const BailOutCheckerType& bailOutChecker, Callback&& callback) | void callChecked (const BailOutCheckerType& bailOutChecker, Callback&& callback) | ||||
| { | { | ||||
| typename ArrayType::ScopedLockType lock (listeners.getLock()); | |||||
| for (Iterator<BailOutCheckerType, ThisType> iter (*this); iter.next (bailOutChecker);) | for (Iterator<BailOutCheckerType, ThisType> iter (*this); iter.next (bailOutChecker);) | ||||
| callback (*iter.getListener()); | callback (*iter.getListener()); | ||||
| } | } | ||||
| @@ -156,6 +162,8 @@ public: | |||||
| const BailOutCheckerType& bailOutChecker, | const BailOutCheckerType& bailOutChecker, | ||||
| Callback&& callback) | Callback&& callback) | ||||
| { | { | ||||
| typename ArrayType::ScopedLockType lock (listeners.getLock()); | |||||
| for (Iterator<BailOutCheckerType, ThisType> iter (*this); iter.next (bailOutChecker);) | for (Iterator<BailOutCheckerType, ThisType> iter (*this); iter.next (bailOutChecker);) | ||||
| { | { | ||||
| auto* l = iter.getListener(); | auto* l = iter.getListener(); | ||||
| @@ -252,6 +260,8 @@ public: | |||||
| template <typename... MethodArgs, typename... Args> | template <typename... MethodArgs, typename... Args> | ||||
| void call (void (ListenerClass::*callbackFunction) (MethodArgs...), Args&&... args) | void call (void (ListenerClass::*callbackFunction) (MethodArgs...), Args&&... args) | ||||
| { | { | ||||
| typename ArrayType::ScopedLockType lock (listeners.getLock()); | |||||
| for (Iterator<DummyBailOutChecker, ThisType> iter (*this); iter.next();) | for (Iterator<DummyBailOutChecker, ThisType> iter (*this); iter.next();) | ||||
| (iter.getListener()->*callbackFunction) (static_cast<typename TypeHelpers::ParameterType<Args>::type> (args)...); | (iter.getListener()->*callbackFunction) (static_cast<typename TypeHelpers::ParameterType<Args>::type> (args)...); | ||||
| } | } | ||||
| @@ -261,6 +271,8 @@ public: | |||||
| void (ListenerClass::*callbackFunction) (MethodArgs...), | void (ListenerClass::*callbackFunction) (MethodArgs...), | ||||
| Args&&... args) | Args&&... args) | ||||
| { | { | ||||
| typename ArrayType::ScopedLockType lock (listeners.getLock()); | |||||
| for (Iterator<DummyBailOutChecker, ThisType> iter (*this); iter.next();) | for (Iterator<DummyBailOutChecker, ThisType> iter (*this); iter.next();) | ||||
| if (iter.getListener() != listenerToExclude) | if (iter.getListener() != listenerToExclude) | ||||
| (iter.getListener()->*callbackFunction) (static_cast<typename TypeHelpers::ParameterType<Args>::type> (args)...); | (iter.getListener()->*callbackFunction) (static_cast<typename TypeHelpers::ParameterType<Args>::type> (args)...); | ||||
| @@ -271,6 +283,8 @@ public: | |||||
| void (ListenerClass::*callbackFunction) (MethodArgs...), | void (ListenerClass::*callbackFunction) (MethodArgs...), | ||||
| Args&&... args) | Args&&... args) | ||||
| { | { | ||||
| typename ArrayType::ScopedLockType lock (listeners.getLock()); | |||||
| for (Iterator<BailOutCheckerType, ThisType> iter (*this); iter.next (bailOutChecker);) | for (Iterator<BailOutCheckerType, ThisType> iter (*this); iter.next (bailOutChecker);) | ||||
| (iter.getListener()->*callbackFunction) (static_cast<typename TypeHelpers::ParameterType<Args>::type> (args)...); | (iter.getListener()->*callbackFunction) (static_cast<typename TypeHelpers::ParameterType<Args>::type> (args)...); | ||||
| } | } | ||||
| @@ -281,6 +295,8 @@ public: | |||||
| void (ListenerClass::*callbackFunction) (MethodArgs...), | void (ListenerClass::*callbackFunction) (MethodArgs...), | ||||
| Args&&... args) | Args&&... args) | ||||
| { | { | ||||
| typename ArrayType::ScopedLockType lock (listeners.getLock()); | |||||
| for (Iterator<BailOutCheckerType, ThisType> iter (*this); iter.next (bailOutChecker);) | for (Iterator<BailOutCheckerType, ThisType> iter (*this); iter.next (bailOutChecker);) | ||||
| if (iter.getListener() != listenerToExclude) | if (iter.getListener() != listenerToExclude) | ||||
| (iter.getListener()->*callbackFunction) (static_cast<typename TypeHelpers::ParameterType<Args>::type> (args)...); | (iter.getListener()->*callbackFunction) (static_cast<typename TypeHelpers::ParameterType<Args>::type> (args)...); | ||||