Fix race condition: do not mutate data without a mutex.
Made fix that @samx suggested and added test for it
bumping version to 2.1.2
Merge pull request #13 from vaskoz/race_fix

Fix race condition: do not mutate data without a mutex.