Made break_loop() global, can be used in user-defined callback