Interlocked.Increment returns the incremented value, not the original value

This commit is contained in:
Sam Harwell 2013-02-23 23:16:47 -06:00
parent db1ee841c6
commit 68732032e0
1 changed files with 1 additions and 1 deletions

View File

@ -98,7 +98,7 @@ namespace Antlr4.Runtime.Dfa
public virtual DFAState AddState(DFAState state)
{
state.stateNumber = Interlocked.Increment(ref nextStateNumber);
state.stateNumber = Interlocked.Increment(ref nextStateNumber) - 1;
return states.GetOrAdd(state, state);
}