Example #1
0
 [MethodImpl(MethodImplOptions.NoInlining)] // the caller should be inlined, not this method
 private static UnicodeRange CreateRange(ref UnicodeRange range, char first, char last)
 {
     // If the range hasn't been created, create it now.
     // It's ok if two threads race and one overwrites the other's 'range' value.
     range = UnicodeRange.Create(first, last);
     return(range);
 }
Example #2
0
        [MethodImpl(MethodImplOptions.NoInlining)] // the caller should be inlined, not this method
        private static UnicodeRange CreateRange(ref UnicodeRange range, char first, char last)
        {
            // If the range hasn't been created, create it now.
            // It's ok if two threads race and one overwrites the other's 'range' value.
            Debug.Assert(last > first, "Code points were specified out of order.");
            var newRange = UnicodeRange.Create(first, last);

            Volatile.Write(ref range, newRange);
            return(newRange);
        }
Example #3
0
 [MethodImpl(MethodImplOptions.NoInlining)] // the caller should be inlined, not this method
 private static UnicodeRange CreateRange([NotNull] ref UnicodeRange?range, char first, char last)
 {
     // It's ok if two threads race and one overwrites the other's 'range' value.
     Volatile.Write(ref range, UnicodeRange.Create(first, last));
     return(range);
 }