BizHawk/BizHawk.Common/SuperGloballyUniqueID.cs

20 lines
401 B
C#
Raw Normal View History

2020-01-23 00:22:54 +00:00
namespace BizHawk.Common
{
using System;
using System.Diagnostics;
internal static class SuperGloballyUniqueID
{
private static readonly string StaticPart = $"bizhawk-{Process.GetCurrentProcess().Id}-{Guid.NewGuid()}";
private static int ctr;
public static string Next()
{
int myctr;
lock (typeof(SuperGloballyUniqueID)) myctr = ctr++;
return $"{StaticPart}-{myctr}";
}
}
}