Skip to content

Whitespaces in LazyThreadSafetyMode.cs comments #103659

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace System.Threading
public enum LazyThreadSafetyMode
{
/// <summary>
/// This mode makes no guarantees around the thread-safety of the <see cref="Lazy{T}"/> instance. If used from multiple threads, the behavior of the <see cref="Lazy{T}"/> is undefined.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your interest in cleaning things up. However, two spaces after a period is a fairly common convention that was used historically, resulting in over 9000 places it's done in .cs files in this repo. I don't believe it's worth the churn to try to get them to all conform to a single-space-after-a-period rule, and I don't think it's worthwhile fixing comments one file at a time.

/// This mode makes no guarantees around the thread-safety of the <see cref="Lazy{T}"/> instance. If used from multiple threads, the behavior of the <see cref="Lazy{T}"/> is undefined.
/// This mode should be used when a <see cref="Lazy{T}"/> is guaranteed to never be initialized from more than one thread simultaneously and high performance is crucial.
/// If valueFactory throws an exception when the <see cref="Lazy{T}"/> is initialized, the exception will be cached and returned on subsequent accesses to Value. Also, if valueFactory recursively
/// accesses Value on this <see cref="Lazy{T}"/> instance, a <see cref="InvalidOperationException"/> will be thrown.
Expand All @@ -24,19 +24,19 @@ public enum LazyThreadSafetyMode

/// <summary>
/// When multiple threads attempt to simultaneously initialize a <see cref="Lazy{T}"/> instance, this mode allows each thread to execute the
/// valueFactory but only the first thread to complete initialization will be allowed to set the final value of the <see cref="Lazy{T}"/>.
/// Once initialized successfully, any future calls to Value will return the cached result. If valueFactory throws an exception on any thread, that exception will be
/// valueFactory but only the first thread to complete initialization will be allowed to set the final value of the <see cref="Lazy{T}"/>.
/// Once initialized successfully, any future calls to Value will return the cached result. If valueFactory throws an exception on any thread, that exception will be
/// propagated out of Value. If any thread executes valueFactory without throwing an exception and, therefore, successfully sets the value, that value will be returned on
/// subsequent accesses to Value from any thread. If no thread succeeds in setting the value, IsValueCreated will remain false and subsequent accesses to Value will result in
/// the valueFactory delegate re-executing. Also, if valueFactory recursively accesses Value on this <see cref="Lazy{T}"/> instance, an exception will NOT be thrown.
/// subsequent accesses to Value from any thread. If no thread succeeds in setting the value, IsValueCreated will remain false and subsequent accesses to Value will result in
/// the valueFactory delegate re-executing. Also, if valueFactory recursively accesses Value on this <see cref="Lazy{T}"/> instance, an exception will NOT be thrown.
/// </summary>
PublicationOnly,

/// <summary>
/// This mode uses locks to ensure that only a single thread can initialize a <see cref="Lazy{T}"/> instance in a thread-safe manner. In general,
/// This mode uses locks to ensure that only a single thread can initialize a <see cref="Lazy{T}"/> instance in a thread-safe manner. In general,
/// taken if this mode is used in conjunction with a <see cref="Lazy{T}"/> valueFactory delegate that uses locks internally, a deadlock can occur if not
/// handled carefully. If valueFactory throws an exception when the<see cref="Lazy{T}"/> is initialized, the exception will be cached and returned on
/// subsequent accesses to Value. Also, if valueFactory recursively accesses Value on this <see cref="Lazy{T}"/> instance, a <see cref="InvalidOperationException"/> will be thrown.
/// handled carefully. If valueFactory throws an exception when the <see cref="Lazy{T}"/> is initialized, the exception will be cached and returned on
/// subsequent accesses to Value. Also, if valueFactory recursively accesses Value on this <see cref="Lazy{T}"/> instance, a <see cref="InvalidOperationException"/> will be thrown.
/// </summary>
ExecutionAndPublication
}
Expand Down
Loading