Synchronized() public static method

Returns a Group object equivalent to the one supplied that is safe to share between multiple threads.
public static Synchronized ( Group inner ) : Group
inner Group
return Group
Example #1
0
        public static Match Synchronized(Match inner)
        {
            if (inner == null)
            {
                throw new ArgumentNullException();
            }
            int length = inner._matchcount.Length;

            for (int i = 0; i < length; i++)
            {
                Group group = inner.Groups[i];
                Group.Synchronized(group);
            }
            return(inner);
        }
Example #2
0
        /// <summary>
        /// Returns a Match instance equivalent to the one supplied that is safe to share
        /// between multiple threads.
        /// </summary>
        public static Match Synchronized(Match inner)
        {
            if (inner == null)
            {
                throw new ArgumentNullException(nameof(inner));
            }

            int numgroups = inner._matchcount.Length;

            // Populate all groups by looking at each one
            for (int i = 0; i < numgroups; i++)
            {
                Group group = inner.Groups[i];

                // Depends on the fact that Group.Synchronized just
                // operates on and returns the same instance
                Group.Synchronized(group);
            }

            return(inner);
        }