protected static function parentCancellerFunction(self &$parent)
    {
        return function () use (&$parent) {
            --$parent->requiredCancelRequests;

            if ($parent->requiredCancelRequests <= 0) {
                $parent->cancel();
            }

            $parent = null;
        };
    }