// decRefWithParent drops a reference.
//
// parentPG is per incRefWithParent.
//
// Precondition: callers must hold TaskSet.mu for writing.
decRefWithParent drops a reference.

parentPG is per incRefWithParent.

callers must hold TaskSet.mu for writing.
// decRefWithParent drops a reference . // // parentPG is per incRefWithParent . // // Precondition : callers must hold TaskSet . mu for writing .
func (pg *ProcessGroup) decRefWithParent(parentPG *ProcessGroup) {
	if pg != parentPG && (parentPG == nil || pg.session == parentPG.session) {
		pg.ancestors--
	}
	alive := true
	pg.refs.DecRef(func() {
		alive = false 
		for ns := pg.originator.pidns; ns != nil; ns = ns.parent {
			id := ns.pgids[pg]
			delete(ns.pgids, pg)
			delete(ns.processGroups, id)
		}
		pg.session.processGroups.Remove(pg)
		pg.session.DecRef()
	})
	if alive {
		pg.handleOrphan()
	}
}
func ( pg * ProcessGroup ) decRefWithParent ( parentPG * ProcessGroup ) { if pg != parentPG && ( parentPG == nil || pg . session == parentPG . session ) { pg . ancestors -- } alive := true pg . refs . DecRef ( func ( ) { alive = false for ns := pg . originator . pidns ; ns != nil ; ns = ns . parent { id := ns . pgids [ pg ] delete ( ns . pgids , pg ) delete ( ns . processGroups , id ) } pg . session . processGroups . Remove ( pg ) pg . session . DecRef ( ) } ) if alive { pg . handleOrphan ( ) } }
decRefWithParent drops a reference.
decRefWithParent drops a reference .
// See incRefWithParent regarding parent == nil. // don't bother with handleOrphan. // Remove translations from the originator. // Remove the list of process groups.