def postprocess(self):
        T = self.tm.trace
        if T: T.write(self.trace_message(u'Task.postprocess()', self.node))
        targets = set(self.targets)
        pending_children = self.tm.pending_children
        parents = {}
        for t in targets:
            if t.waiting_parents:
                if T: T.write(self.trace_message(u'Task.postprocess()',
                                                 t,
                                                 'removing'))
                pending_children.discard(t)
            for p in t.waiting_parents:
                parents[p] = parents.get(p, 0) + 1
        for t in targets:
            if t.side_effects is not None:
                for s in t.side_effects:
                    if s.get_state() == NODE_EXECUTING:
                        s.set_state(NODE_NO_STATE)
                        for p in s.waiting_parents:
                            parents[p] = parents.get(p, 0) + 1
                    for p in s.waiting_s_e:
                        if p.ref_count == 0:
                            self.tm.candidates.append(p)
        for p, subtract in parents.items():
            p.ref_count = p.ref_count - subtract
            if T: T.write(self.trace_message(u'Task.postprocess()',
                                             p,
                                             'adjusted parent ref count'))
            if p.ref_count == 0:
                self.tm.candidates.append(p)
        for t in targets:
            t.postprocess()