Class ErlMbox
Provides a simple mechanism for exchanging messages with Erlang
processes or other instances of this class
Inheritance
System.Object
ErlMbox
Implements
System.IDisposable
Inherited Members
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Assembly: NFX.Erlang.dll
Syntax
public class ErlMbox : DisposableObject, IDisposable
Properties
Empty
Return true if there are no messages waiting in the receive queue
of this connection
Declaration
public bool Empty { get; }
Property Value
Type |
Description |
System.Boolean |
|
Handle
Queue not empty status notification handle
Declaration
public WaitHandle Handle { get; }
Property Value
Type |
Description |
System.Threading.WaitHandle |
|
MsgCount
Return the number of messages currently waiting in the receive
queue of this connection
Declaration
public int MsgCount { get; }
Property Value
Type |
Description |
System.Int32 |
|
Name
Get the registered name of this mailbox, or string.Empty if the
mailbox doesn't have a registered name
Declaration
public ErlAtom Name { get; }
Property Value
Node
Declaration
public ErlLocalNode Node { get; }
Property Value
QueueActive
Declaration
public bool QueueActive { get; }
Property Value
Type |
Description |
System.Boolean |
|
Self
Get the Pid identifying associated with this mailbox
Declaration
public ErlPid Self { get; }
Property Value
Methods
AsyncRPC(ErlAtom, ErlAtom, ErlAtom, ErlList, IErlObject, Nullable<ErlAtom>)
Send RPC call to a given node.
Declaration
public void AsyncRPC(ErlAtom node, ErlAtom mod, ErlAtom fun, ErlList args, IErlObject ioServer, ErlAtom? remoteCookie = default (ErlAtom? ))
Parameters
Type |
Name |
Description |
ErlAtom |
node |
Destination node for this RPC call
|
ErlAtom |
mod |
Module name to call
|
ErlAtom |
fun |
Function name to call
|
ErlList |
args |
Function arguments
|
IErlObject |
ioServer |
Either a PID or an Atom containing registered I/O server's name.
|
System.Nullable<ErlAtom> |
remoteCookie |
Remote cookie
|
AsyncRPC(ErlAtom, ErlAtom, ErlAtom, ErlList, Nullable<ErlAtom>)
Declaration
public void AsyncRPC(ErlAtom node, ErlAtom mod, ErlAtom fun, ErlList args, ErlAtom? remoteCookie = default (ErlAtom? ))
Parameters
AsyncRPC(ErlAtom, String, String, ErlList, ErlPid, Nullable<ErlAtom>)
Declaration
public void AsyncRPC(ErlAtom node, string mod, string fun, ErlList args, ErlPid ioServer, ErlAtom? remoteCookie = default (ErlAtom? ))
Parameters
Type |
Name |
Description |
ErlAtom |
node |
|
System.String |
mod |
|
System.String |
fun |
|
ErlList |
args |
|
ErlPid |
ioServer |
|
System.Nullable<ErlAtom> |
remoteCookie |
|
AsyncRPC(ErlAtom, String, String, ErlList, Nullable<ErlAtom>)
Declaration
public void AsyncRPC(ErlAtom node, string mod, string fun, ErlList args, ErlAtom? remoteCookie = default (ErlAtom? ))
Parameters
Type |
Name |
Description |
ErlAtom |
node |
|
System.String |
mod |
|
System.String |
fun |
|
ErlList |
args |
|
System.Nullable<ErlAtom> |
remoteCookie |
|
Clear()
Declaration
Dequeue(Int32)
Declaration
protected IQueable Dequeue(int timeout = -1)
Parameters
Type |
Name |
Description |
System.Int32 |
timeout |
|
Returns
Destructor()
Declaration
protected override void Destructor()
Overrides
Down(ErlRef, ErlPid, ErlAtom)
Declaration
public void Down(ErlRef eref, ErlPid pid, ErlAtom reason)
Parameters
Enqueue(IQueable)
Declaration
protected void Enqueue(IQueable data)
Parameters
Equals(Object)
Determine if two mailboxes are equal
Declaration
public override bool Equals(object o)
Parameters
Type |
Name |
Description |
System.Object |
o |
|
Returns
Type |
Description |
System.Boolean |
|
Overrides
System.Object.Equals(System.Object)
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type |
Description |
System.Int32 |
|
Overrides
System.Object.GetHashCode()
Link(ErlPid)
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
Declaration
public void Link(ErlPid to)
Parameters
Type |
Name |
Description |
ErlPid |
to |
|
OnMailboxMessage(IQueable)
Declaration
protected virtual bool OnMailboxMessage(IQueable msg)
Parameters
Returns
Type |
Description |
System.Boolean |
|
Receive(Int32)
Wait for a message to arrive for this mailbox. On timeout return null
Declaration
public IErlObject Receive(int timeout = -1)
Parameters
Type |
Name |
Description |
System.Int32 |
timeout |
Timeout time in milliseconds
|
Returns
receiveBuf(Int32)
Wait for a message to arrive for this mailbox
Declaration
public ErlInputStream receiveBuf(int timeout)
Parameters
Type |
Name |
Description |
System.Int32 |
timeout |
time in milliseconds
|
Returns
Type |
Description |
ErlInputStream |
a stream representing the still-encoded body of the next
message waiting in this mailbox, or null on timeout
|
ReceiveMatch(ErlPatternMatcher, Int32)
Receive a message and match it against a given pattern
Declaration
public Tuple<IErlObject, int> ReceiveMatch(ErlPatternMatcher pm, int timeoutMsec = -1)
Parameters
Type |
Name |
Description |
ErlPatternMatcher |
pm |
Patterns to match the message against
|
System.Int32 |
timeoutMsec |
Timeout in milliseconds
|
Returns
Type |
Description |
System.Tuple<IErlObject, System.Int32> |
Return a tuple containing the received message and index of the
pattern in the pm instance that was successfully matched.
On timeout the 2nd element of the tuple is -2 and 1st element of the tuple is null.
On unsuccessful match the second element of the tuple is -1
|
ReceiveMatch(IErlObject, Int32)
Receive a message and match it against a given pattern
Declaration
public Tuple<IErlObject, ErlVarBind> ReceiveMatch(IErlObject pattern, int timeoutMsec = -1)
Parameters
Type |
Name |
Description |
IErlObject |
pattern |
Pattern to match the message against
|
System.Int32 |
timeoutMsec |
Timeout in milliseconds
|
Returns
Type |
Description |
System.Tuple<IErlObject, ErlVarBind> |
Return a tuple containing the received message and variable
binding object. On timeout the first element of the tuple is null.
On unsuccessful match the second element of the tuple is null
|
ReceiveRPC(Int32)
Declaration
public IErlObject ReceiveRPC(int timeout = -1)
Parameters
Type |
Name |
Description |
System.Int32 |
timeout |
|
Returns
Register(ErlAtom)
Declaration
public bool Register(ErlAtom name)
Parameters
Returns
Type |
Description |
System.Boolean |
|
Register(String)
Register a name for this mailbox. Registering a
name for a mailbox enables others to send messages without
knowing the ErlPid of the mailbox. A mailbox
can have at most one name; if the mailbox already had a name,
calling this method will supercede that name
Declaration
public bool Register(string name)
Parameters
Type |
Name |
Description |
System.String |
name |
|
Returns
Type |
Description |
System.Boolean |
true if the name was available, or false otherwise
|
RPC(ErlAtom, ErlAtom, ErlAtom, ErlList, Int32, Nullable<ErlAtom>)
Declaration
public IErlObject RPC(ErlAtom node, ErlAtom mod, ErlAtom fun, ErlList args, int timeout, ErlAtom? remoteCookie = default (ErlAtom? ))
Parameters
Returns
RPC(ErlAtom, ErlAtom, ErlAtom, ErlList, Nullable<ErlAtom>)
Declaration
public IErlObject RPC(ErlAtom node, ErlAtom mod, ErlAtom fun, ErlList args, ErlAtom? remoteCookie = default (ErlAtom? ))
Parameters
Returns
RPC(ErlAtom, String, String, ErlList, Int32, Nullable<ErlAtom>)
Declaration
public IErlObject RPC(ErlAtom node, string mod, string fun, ErlList args, int timeout, ErlAtom? remoteCookie = default (ErlAtom? ))
Parameters
Type |
Name |
Description |
ErlAtom |
node |
|
System.String |
mod |
|
System.String |
fun |
|
ErlList |
args |
|
System.Int32 |
timeout |
|
System.Nullable<ErlAtom> |
remoteCookie |
|
Returns
RPC(ErlAtom, String, String, ErlList, Nullable<ErlAtom>)
Declaration
public IErlObject RPC(ErlAtom node, string mod, string fun, ErlList args, ErlAtom? remoteCookie = default (ErlAtom? ))
Parameters
Type |
Name |
Description |
ErlAtom |
node |
|
System.String |
mod |
|
System.String |
fun |
|
ErlList |
args |
|
System.Nullable<ErlAtom> |
remoteCookie |
|
Returns
RPCcast(ErlAtom, ErlAtom, ErlAtom, ErlList)
Declaration
public void RPCcast(ErlAtom node, ErlAtom mod, ErlAtom fun, ErlList args)
Parameters
RPCcast(ErlAtom, ErlAtom, ErlAtom, ErlList, IErlObject)
Declaration
public void RPCcast(ErlAtom node, ErlAtom mod, ErlAtom fun, ErlList args, IErlObject ioServer)
Parameters
Send(ErlAtom, ErlAtom, IErlObject)
Send a message to a named mailbox created from another node
Declaration
public bool Send(ErlAtom node, ErlAtom name, IErlObject msg)
Parameters
Returns
Type |
Description |
System.Boolean |
|
Unlink(ErlPid)
Remove a link to a remote mailbox or Erlang process. This
method removes a link created with ErlLink
Links are idempotent; calling this method once will remove all
links between this mailbox and the remote ErlPid
Declaration
public void Unlink(ErlPid to)
Parameters
Type |
Name |
Description |
ErlPid |
to |
|
Events
MailboxMessage
If this event is assigned, it will be called on arrival of a message, but
the messages will not be put in the queue
Declaration
public event MailboxMsgEventHandler MailboxMessage
Event Type
Implements
System.IDisposable
Extension Methods