Beispiel #1
0
            //[UsedImplicitly]
            private void HandleEvent(object sender, EventArgs e)
            {
                using (_manager.ReadLock)
                    _listeners.BeginUse();

                try { _manager.DeliverEventToList(sender, e, _listeners); }
                finally { _listeners.EndUse(); }
            }
            /// <summary>
            /// If the given list is in use (which means an event is currently
            /// being delivered), replace it with a clone.  The existing
            /// users will finish delivering the event to the original list,
            /// without interference from changes to the new list.
            /// </summary>
            /// <returns>
            /// True if the list was cloned.  Callers will probably want to
            /// insert the new list in their own data structures.
            /// </returns>
            public static bool PrepareForWriting(ref ListenerList list)
            {
                bool inUse = list.BeginUse();

                list.EndUse();

                if (inUse)
                {
                    list = list.Clone();
                }

                return(inUse);
            }
Beispiel #3
0
            /// <summary>
            /// If the given list is in use (which means an event is currently
            /// being delivered), replace it with a clone.  The existing
            /// users will finish delivering the event to the original list,
            /// without interference from changes to the new list.
            /// </summary>
            /// <returns>
            /// True if the list was cloned.  Callers will probably want to
            /// insert the new list in their own data structures.
            /// </returns>
            public static bool PrepareForWriting(ref ListenerList list)
            {
                bool inUse = list.BeginUse();
                list.EndUse();

                if (inUse)
                {
                    list = list.Clone();
                }

                return inUse;
            }