Thread-safe access to array with callbacks