Synchronization between reader and counts petitioner changed to avoid a possible deadlock