Make most methods in writer and reader thread-safe.