global

def <=>(other)

def <=>(other)
	# Higher priority comes first, then FIFO for equal priorities:
	if priority == other.priority
		# Use sequence for FIFO behavior (lower sequence = earlier):
		sequence <=> other.sequence
	else
		other.priority <=> priority  # Reverse for max-heap behavior
	end
end