Skip to content

Commit

Permalink
Cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkCiliaVincenti committed Sep 9, 2024
1 parent ae7896f commit 51e9342
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 23 deletions.
2 changes: 2 additions & 0 deletions Backport.System.Threading.Lock/Lock.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using System.Runtime.CompilerServices;

#if NET5_0_OR_GREATER && !NET9_0_OR_GREATER
namespace System.Threading;

/// <summary>
/// A backport of .NET 9.0+'s System.Threading.Lock. Provides a way to get mutual exclusion in regions of code between different threads.
/// A lock may be held by one thread at a time.
Expand Down
45 changes: 22 additions & 23 deletions Backport.System.Threading.Lock/LockFactory.cs
Original file line number Diff line number Diff line change
@@ -1,34 +1,33 @@
using FrameworkNamespace = System.Threading;

namespace Backport.System.Threading
{
namespace Backport.System.Threading;

#if NET9_0_OR_GREATER
/// <summary>
/// Represents a factory class for backporting .NET 9.0's System.Threading.Lock to prior framework versions.
/// If your project does not target anything before .NET 5.0, you do not need to use this; simply use <see cref="FrameworkNamespace.Lock"/>.
/// </summary>
public static class LockFactory
{
/// <summary>
/// Represents a factory class for backporting .NET 9.0's System.Threading.Lock to prior framework versions.
/// Creates a new instance of <see cref="FrameworkNamespace.Lock"/>. On frameworks prior to .NET 9.0, a different backported class is returned.
/// If your project does not target anything before .NET 5.0, you do not need to use this; simply use <see cref="FrameworkNamespace.Lock"/>.
/// </summary>
public static class LockFactory
{
/// <summary>
/// Creates a new instance of <see cref="FrameworkNamespace.Lock"/>. On frameworks prior to .NET 9.0, a different backported class is returned.
/// If your project does not target anything before .NET 5.0, you do not need to use this; simply use <see cref="FrameworkNamespace.Lock"/>.
/// </summary>
/// <returns>An instance of <see cref="FrameworkNamespace.Lock"/>.</returns>
public static FrameworkNamespace.Lock Create() => new();
}
/// <returns>An instance of <see cref="FrameworkNamespace.Lock"/>.</returns>
public static FrameworkNamespace.Lock Create() => new();
}
#else
/// <summary>
/// Represents a factory class for backporting .NET 9.0's System.Threading.Lock to prior framework versions.
/// If your project does not target anything before .NET 5.0, you do not need to use this; simply use System.Threading.Lock.
/// </summary>
public static class LockFactory
{
/// <summary>
/// Represents a factory class for backporting .NET 9.0's System.Threading.Lock to prior framework versions.
/// Creates a new instance of <see cref="Lock"/>. On .NET 9.0 or later, an instance of System.Threading.Lock is returned.
/// If your project does not target anything before .NET 5.0, you do not need to use this; simply use System.Threading.Lock.
/// </summary>
public static class LockFactory
{
/// <summary>
/// Creates a new instance of <see cref="Lock"/>. On .NET 9.0 or later, an instance of System.Threading.Lock is returned.
/// If your project does not target anything before .NET 5.0, you do not need to use this; simply use System.Threading.Lock.
/// </summary>
/// <returns>An instance of <see cref="Lock"/>.</returns>
public static Lock Create() => new();
}
#endif
/// <returns>An instance of <see cref="Lock"/>.</returns>
public static Lock Create() => new();
}
#endif
2 changes: 2 additions & 0 deletions Backport.System.Threading.Lock/PreNet5Lock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
using System;
using System.Runtime.CompilerServices;
using System.Threading;

namespace Backport.System.Threading;

/// <summary>
/// A backport of .NET 9.0+'s System.Threading.Lock. Provides a way to get mutual exclusion in regions of code between different threads.
/// A lock may be held by one thread at a time. Do not try and create an instance of this class; use <see cref="LockFactory.Create()"/>.
Expand Down

0 comments on commit 51e9342

Please sign in to comment.