/// <summary> /// Send an RPC cast request to the remote Erlang node /// </summary> public void SendRPCcast(ErlPid from, string mod, string fun, ErlList args) { IErlObject rpc = Internal.ErlRpcServer.EncodeRPCcast(from, mod, fun, args, ConstAtoms.User); var msg = ErlMsg.RegSend(from, ConstAtoms.Rex, rpc); Send(msg); }
/// <summary> /// Link to a remote mailbox or Erlang process. Links are /// idempotent, calling this method multiple times will not result in /// more than one link being created /// </summary> /// <remarks> /// If the remote process subsequently exits or the mailbox is /// closed, a subsequent attempt to retrieve a message through this /// mailbox will cause an {@link Exit Exit} /// exception to be raised. Similarly, if the sending mailbox is /// closed, the linked mailbox or process will receive an exit /// signal. /// /// If the remote process cannot be reached in order to set the /// link, the exception is raised immediately. /// </remarks> public void Link(ErlPid to) { Debug.Assert(to != m_Self); if (m_Node.Deliver(ErlMsg.Link(m_Self, to))) { m_Links.Add(to); } }
/// <summary> /// Write an Erlang PID to the stream /// </summary> public void WritePid(ErlPid pid) { Debug.Assert(pid != ErlPid.Null); write(ErlExternalTag.Pid); WriteAtom(pid.Node); Write4BE(pid.Id & 0x7fff); // 15 bits Write4BE(pid.Serial & 0x1fff); // 13 bits Write1((byte)(pid.Creation & 0x3)); // 2 bits }
internal ErlMbox(ErlLocalNode home, ErlPid self, ErlAtom name) { m_Self = self; m_Node = home; m_RegName = name; m_Queue = new ErlBlockingQueue <IQueable>(); m_Links = new ErlLinks(); m_Monitors = new ErlMonitors(this); }
/// <summary> /// Send a message to a remote <see cref="ErlPid"/>, representing /// either another <see cref="ErlMbox"/> or an Erlang process /// </summary> /// <returns>true if message was sent successfully</returns> public bool Send(ErlPid to, IErlObject msg) { return(Deliver(ErlMsg.Send(to, msg))); }
/// <summary> /// Send an Erlang term to a Pid on a local or remote node /// </summary> public void Send(ErlPid dest, IErlObject msg) { base.Send(ErlMsg.Send(dest, msg, SendCookie)); }
/* * send to remote name * dest is recipient's registered name, the nodename is implied by * the choice of connection. */ public void Send(ErlPid from, ErlAtom dest, IErlObject msg) { // encode and send the message base.Send(ErlMsg.RegSend(from, dest, msg, SendCookie)); }
internal static ErlMsg Exit2TT(ErlPid from, ErlPid dest, IErlObject reason, ErlTrace traceToken) { return(new ErlMsg(Tag.Exit2TT, from, dest, reason: reason, trace: traceToken)); }
public ErlDown(ErlRef eref, ErlPid pid, IErlObject reason) : base(pid, reason) { Ref = eref; }
internal static ErlMsg DemonitorP(ErlPid from, IErlObject /* Pid or Atom */ dest, ErlRef eref) { return(new ErlMsg(Tag.DemonitorP, from, dest, eref: eref)); }
internal static ErlMsg Send(ErlPid dest, IErlObject msg, ErlAtom?cookie = null) { return(new ErlMsg(Tag.Send, ErlPid.Null, dest, payload: msg, cookie: cookie)); }
public ErlLink(ErlPid remote) { Node = remote.Node; Pid = remote; }
public void AsyncRPC(ErlAtom node, string mod, string fun, ErlList args, ErlPid ioServer, ErlAtom?remoteCookie = null) { AsyncRPC(node, new ErlAtom(mod), new ErlAtom(fun), args, (IErlObject)ioServer, remoteCookie); }
public bool Remove(ErlPid to) { return(Remove(new ErlLink(to))); }
public ErlLink(ErlAtom remoteNode) { Node = remoteNode; Pid = ErlPid.Null; }
public bool Add(ErlPid to) { return(Add(new ErlLink(to))); }
public bool Equals(ErlPid remote) { return(Pid.Equals(remote)); }
public void AsyncRPC(ErlAtom node, string mod, string fun, ErlList args, ErlPid ioServer) { AsyncRPC(node, new ErlAtom(mod), new ErlAtom(fun), args, (IErlObject)ioServer); }
/// <summary> /// Send a message to a named mailbox on local node /// </summary> public bool Send(ErlPid from, ErlAtom toName, IErlObject msg) { return(Deliver(ErlMsg.RegSend(from, toName, msg))); }
internal static ErlMsg MonitorPexit(IErlObject from, ErlPid dest, ErlRef eref, IErlObject reason) { return(new ErlMsg(Tag.MonitorPexit, from, dest, eref: eref, reason: reason)); }
/// <summary> /// Create an Erlang trace from the given arguments /// </summary> public ErlTrace(int flags, int label, int serial, ErlPid from, int prev) : base(flags, label, serial, from, prev) { }
/// <summary> /// Create a mailbox with optional name /// </summary> internal ErlMbox(ErlLocalNode home, ErlPid self, string name = null) : this(home, self, name == null ? ErlAtom.Null : new ErlAtom(name)) { }
public bool Contains(ErlPid pid) { return(pid.Equals(Pid)); }
// All message types are described here: // http://www.erlang.org/doc/apps/erts/erl_dist_protocol.html#id91435 internal static ErlMsg Link(ErlPid from, ErlPid dest) { return(new ErlMsg(Tag.Link, from, dest)); }
public void Down(ErlRef eref, ErlPid pid, ErlAtom reason) { // TODO throw new NotImplementedException(); }
public bool Equals(ErlPid remote) { return(remote.Equals(Pid)); }
/// <summary> /// Remove a link to a remote mailbox or Erlang process. This /// method removes a link created with <see cref="ErlLink"/> /// Links are idempotent; calling this method once will remove all /// links between this mailbox and the remote <see cref="ErlPid"/> /// </summary> public void Unlink(ErlPid to) { m_Links.Remove(to); m_Node.Deliver(ErlMsg.Unlink(m_Self, to)); }
public ErlExit(ErlPid pid, string reason) : this(pid, (IErlObject) new ErlString(reason)) { }
public ErlExit(ErlPid pid, IErlObject reason) : base(pid.Node, reason) { Pid = pid; }
internal static ErlMsg RegSendTT(ErlPid from, ErlAtom dest, IErlObject msg, ErlTrace trace, ErlAtom?cookie = null) { return(new ErlMsg(Tag.RegSend, from, dest, payload: msg, cookie: cookie)); }