@BIF public static EObject register(EObject name, EObject pid) { EAtom aname; EHandle handle = pid.testHandle(); if ((aname = name.testAtom()) == null || handle == null) throw ERT.badarg(name, pid); ERT.register(aname, handle); return ERT.TRUE; }
@BIF public static EAtom exit(EProc proc, EObject p, EObject reason) throws Pausable { // System.err.println(proc.self_handle() + ":: erlang:exit(" + p + ", " + reason + ")"); EHandle pid = p.testHandle(); if (pid == null) throw ERT.badarg(p, reason); if (pid == proc.self_handle()) { throw new ErlangExit(reason, proc.self_handle()); } pid.exit_signal(proc.self_handle(), reason, true); return ERT.TRUE; }
public static EObject demonitor(ETask<?> self, EObject ref, EObject options) throws Pausable { ERef r = ref.testReference(); ESeq o = options.testSeq(); if (r == null || o == null) throw ERT.badarg(ref, options); boolean flush = (!o.isNil() && o.head() == am_flush); EObject found = self.demonitor(r); if (found == null) { return ERT.FALSE; } EHandle h; ETuple tup; EAtom name; EAtom node; if ((h = found.testHandle()) != null) { h.remove_monitor(self.self_handle(), r, flush); } else if ((tup = found.testTuple()) != null && tup.arity() == 2 && (name = tup.elm(1).testAtom()) != null && (node = tup.elm(2).testAtom()) != null) { EAbstractNode n = EAbstractNode.get_or_connect(self, node); if (n != null) { n.dsig_demonitor(self.self_handle(), r, name); } } if (flush && (self instanceof EProc)) { flush_monitor_message.invoke((EProc) self, new EObject[] {ref, ERT.am_ok}); } return ERT.TRUE; }