Skip to content

Commit a7cdf6e

Browse files
committed
ops.uid: Use Interlocked.Increment instead of ++
1 parent 8cb6470 commit a7cdf6e

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎src/TensorFlowNET.Core/ops.cs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ public static Graph get_default_graph()
9393
//return _default_graph_stack.get_default()
9494
return default_graph_stack.get_controller();
9595
}
96+
9697
public static Graph set_default_graph(Graph graph)
9798
{
9899
//TODO: original source does not have a 'set_default_graph' and indicates there should be a _default_graph_stack!
@@ -311,7 +312,7 @@ public static void init_scope()
311312
/// <returns></returns>
312313
public static int uid()
313314
{
314-
return uid_number++;
315+
return Interlocked.Increment(ref uid_number);
315316
}
316317

317318
public static void colocate_with(bool ignore_existing = false)

0 commit comments

Comments
 (0)