'Register process with L{ProcessMonitor}
@param p: Process
@type  p: L{Process}
@raise PmonException: if process with same name is already registered'

def register(self, p):

    e = None
    with self.plock:
        if self.has_process(p.name):
            e = PmonException(("cannot    add    process    with    duplicate    name    '%s'" % p.name))
        elif self.is_shutdown:
            e = PmonException(('cannot    add    process    [%s]    after    process    monitor    has    been    shut    down' % p.name))
        else:
            self.procs.append(p)
    if e:
        raise e
