Example #1
0
        // 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);
        }
Example #2
0
 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));
     }
 }
Example #3
0
        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);
        }
Example #4
0
        // 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);
            }
        }
Example #5
0
        // 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;
            }
        }
Example #6
0
        // 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);
        }
Example #7
0
        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);
        }