diff --git a/modules/juce_core/containers/juce_ListenerList.h b/modules/juce_core/containers/juce_ListenerList.h index 4856f321b06..cc8a4ddc5ec 100644 --- a/modules/juce_core/containers/juce_ListenerList.h +++ b/modules/juce_core/containers/juce_ListenerList.h @@ -67,7 +67,8 @@ namespace juce @tags{Core} */ template > + typename ArrayType = Array, + typename LockMode = ScopedTryLock> class ListenerList { public: @@ -230,13 +231,16 @@ class ListenerList Callback&& callback) { #if JUCE_ASSERTIONS_ENABLED_OR_LOGGED - const ScopedTryLock callCheckedExcludingLock (*callCheckedExcludingMutex); + const LockMode callCheckedExcludingLock (*callCheckedExcludingMutex); // If you hit this assertion it means you're trying to call the listeners from multiple // threads concurrently. If you need to do this either use a LightweightListenerList, for a // lock free option, or a ThreadSafeListenerList if you also need the extra guarantees // provided by ListenerList. See the class descriptions for more details. - jassert (callCheckedExcludingLock.isLocked()); + if (std::is_same()) + { + jassert(((const ScopedTryLock*)&callCheckedExcludingLock)->isLocked()); + } #endif if (! initialised()) @@ -415,6 +419,9 @@ class ListenerList */ template using ThreadSafeListenerList = ListenerList>; +template +using ThreadSafeBlockingListenerList = ListenerList, ScopedLock>; + //============================================================================== /**