I’d use a simple (atomic) busy flag or budget (up/down) counter of the target task as proposed by @richard-damon. As far as I got it you want to detect task notifications while the target task hasn’t completed its work triggered by the previous notification.
Seems that would be sufficient.