Implement locking on input callbacks.