Use atomic instead of mutex to increment one integer

Just was lurking through the source code and found a candidate for the first pull request. Please take a look.