Detect C finalizer callbacks in rts_lock() instead of schedule()