synchronized global counter - Graham-Cumming