You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Default counter should in public API, not private hidden surprise in production.
Consider return error(value tuple, option, or by ref return) result from Swap instead of throwing exception. Retry exceed could be normal condition on low level.
/// <summary>Compares current Referred value with <paramref name="currentValue"/> and if equal replaces current with <paramref name="newValue"/></summary>
consider document reference equals instead of equals (to be crystal clear).
CompareAndSwap or other like name may be better name
Consider document usage scenarios, i.e. it seems not for long running operations, not ordered operations (while does not orders getNewValue delegates).
public static X TryEnterWriteLock(ref X value, TimeSpan timeout)
{
// https://github.com/dotnet/corefx/blob/3b24c535852d19274362ad3dbc75e932b7d41766/src/Common/src/CoreLib/System/Threading/ReaderWriterLockSlim.cs#L233
var tracker = new TimeoutTracker(timeout);
if (tracker.IsExpired)
{
throw new TimeoutException("Some other lock is hold for too long time");
}
Did some view onto, hope you find some useful.
ImTools/src/ImTools/ImTools.cs
Line 534 in 56b7f53
Also it is public, it may deliver some caveats to possible users:
ImTools/src/ImTools.UnitTests/RefTests.cs
Line 7 in 56b7f53
ImTools/src/ImTools/ImTools.cs
Line 524 in 56b7f53
ImTools/src/ImTools/ImTools.cs
Line 489 in 56b7f53
reference equals
instead ofequals
(to be crystal clear).ImTools/src/ImTools/ImTools.cs
Line 497 in 56b7f53
ImTools/src/ImTools/ImTools.cs
Line 498 in 56b7f53
==
https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/operators/equality-comparison-operator. Same seems hereImTools/src/ImTools/ImTools.cs
Line 531 in 56b7f53
The text was updated successfully, but these errors were encountered: