Last active
May 1, 2019 13:54
-
-
Save fumobox/73e0009262f0d84e92e0d61173f9790b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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