Browse Source

Create Locks.cs

tags/v0.12
Eli Belash 6 years ago
parent
commit
e28d09469f
1 changed files with 21 additions and 0 deletions
  1. +21
    -0
      src/TensorFlowNET.Core/Util/Locks.cs

+ 21
- 0
src/TensorFlowNET.Core/Util/Locks.cs View File

@@ -0,0 +1,21 @@
using System.Threading;

namespace Tensorflow.Util
{
/// <summary>
/// Provides a set of locks on different shared levels.
/// </summary>
public static class Locks
{
private static readonly ThreadLocal<object> _lockpool = new ThreadLocal<object>(() => new object());

/// <summary>
/// A seperate lock for every requesting thread.
/// </summary>
/// <remarks>This property is thread-safe.</remarks>
public static object ThreadWide => _lockpool.Value;


public static readonly object ProcessWide = new object();
}
}

Loading…
Cancel
Save