I wonder if it would be better to use a data structure that doesn't require any synchronization.