function Subscription.IsPending(A)return A._state==stateTypes.PENDING end function Subscription._giveCleanup(O,A)assert(A,"\066\097\100 \116\097\115\107")assert(not O._cleanupTask,"\065\108\114\101\097\100\121 \104\097\118\101 \095\099\108\101\097\110\117\112\084\097\115\107")if O._state~=stateTypes.PENDING then MaidTaskUtils.doTask(A)return end O._cleanupTask=A end function Subscription._doCleanup(A)if A._cleanupTask then local O=A._cleanupTask A._cleanupTask=nil MaidTaskUtils.doTask(O)end end

function Subscription:IsPending()
	return self._state == stateTypes.PENDING
end

function Subscription:_giveCleanup(task)
	assert(task, "Bad task")
	assert(not self._cleanupTask, "Already have _cleanupTask")

	if self._state ~= stateTypes.PENDING then
		MaidTaskUtils.doTask(task)
		return
	end

	self._cleanupTask = task
end

function Subscription:_doCleanup()
	if self._cleanupTask then
		local task = self._cleanupTask
		self._cleanupTask = nil
		MaidTaskUtils.doTask(task)
	end
end
