public void addLink(OtpErlangPid local, OtpErlangPid remote) { lock (this) { if (find(local, remote) == -1) { if (count >= links.Length) { Link[] tmp = new Link[count * 2]; Array.Copy(links, 0, tmp, 0, count); links = tmp; } links[count++] = new Link(local, remote); } } }
/* clears the link table, returns a copy */ public Link[] clearLinks() { lock (this) { Link[] ret = null; if (count != 0) { ret = new Link[count]; for (int i = 0; i < count; i++) { ret[i] = links[i]; links[i] = null; } count = 0; } return ret; } }