AtomicCounter fix for GH #282: Using Thread in a global can cause crash on Windows