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); }
/// <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); }