Replace busy-wait with proper signal handling.