// Always called when process is locked public void SetValue(string s, string status, byte[] value, bool unblock) { MailboxRecord record; if (!mailbox.TryGetValue(s, out record)) { record = new MailboxRecord(); mailbox.Add(s, record); } record.SetValue(status, value, unblock); }
private void UnblockMailboxes() { foreach (var k in mailbox) { MailboxRecord r = k.Value; // r.Unblock increments r's version r.Unblock(); string s; byte[] v; logger.Log("mailbox", "Unblocking " + k.Key + " with version " + r.GetValue(out s, out v)); } }
public ProcessRecord(int i, ILogger l, Action collect) { logger = l; collector = collect; id = i; status = ProcessStatus.Queued; exitCode = unchecked ((int)Constants.WinError_StillActive); mailbox = new Dictionary <string, MailboxRecord>(); // every process has a record corresponding to the 'null' key that is used for monitoring // the lifetime of the process var record = new MailboxRecord(); mailbox.Add(Constants.NullKeyString, record); }
// Always called when process is locked public Task GetValue(string s, UInt64 lastSeenVersion, out UInt64 currentVersion, out string shortStatus, out byte[] value) { MailboxRecord record; if (!mailbox.TryGetValue(s, out record)) { record = new MailboxRecord(); mailbox.Add(s, record); } currentVersion = record.GetValue(out shortStatus, out value); if (lastSeenVersion < currentVersion || status == ProcessStatus.Completed) { return(null); } else { return(record.Waiter); } }
// Always called when process is locked public Task GetValue(string s, UInt64 lastSeenVersion, out UInt64 currentVersion, out string shortStatus, out byte[] value) { MailboxRecord record; if (!mailbox.TryGetValue(s, out record)) { record = new MailboxRecord(); mailbox.Add(s, record); } currentVersion = record.GetValue(out shortStatus, out value); if (lastSeenVersion < currentVersion || status == ProcessStatus.Completed) { return null; } else { return record.Waiter; } }
public ProcessRecord(int i, ILogger l, Action collect) { logger = l; collector = collect; id = i; status = ProcessStatus.Queued; exitCode = unchecked((int)Constants.WinError_StillActive); mailbox = new Dictionary<string, MailboxRecord>(); // every process has a record corresponding to the 'null' key that is used for monitoring // the lifetime of the process var record = new MailboxRecord(); mailbox.Add(Constants.NullKeyString, record); }