finer-grained locking in callback