Skip to content

Instantly share code, notes, and snippets.

@fumobox
Last active May 1, 2019 13:54
Show Gist options
  • Save fumobox/73e0009262f0d84e92e0d61173f9790b to your computer and use it in GitHub Desktop.
Save fumobox/73e0009262f0d84e92e0d61173f9790b to your computer and use it in GitHub Desktop.
using System;
public static class LoopBreaker
{
private static long[] _counts = new long[10];
private static long Limit = 10000;
public static void Increment(int id = 0)
{
_counts[id]++;
if (_counts[id] >= Limit)
{
throw new Exception("Out of limit !");
}
}
public static void Reset(int id = 0)
{
_counts[id] = 0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment