Beispiel #1
0
 private IExpression Generate(ProcessSemaphoreInfo arg)
 {
     return(new ObjectLiteralExpression(
                new PropertyAssignment("name", Generate(arg.Name)),
                new PropertyAssignment("incrementBy", Generate(arg.Value)),
                new PropertyAssignment("limit", Generate(arg.Limit))));
 }
Beispiel #2
0
 private string CreateSemaphore(ProcessSemaphoreInfo semaphore)
 {
     return(string.Format(
                CultureInfo.InvariantCulture,
                "{0} (value:{1} limit:{2})",
                semaphore.Name.ToString(StringTable),
                semaphore.Value,
                semaphore.Limit));
 }
Beispiel #3
0
        /// <nodoc />
        public void SetSemaphore(string name, int limit, int incrementBy)
        {
            Contract.Requires(!string.IsNullOrEmpty(name));
            Contract.Requires(incrementBy > 0);
            Contract.Requires(limit > 0);

            m_semaphores = m_semaphores ?? new Dictionary <StringId, ProcessSemaphoreInfo>();
            var key = StringId.Create(m_pathTable.StringTable, name);

            m_semaphores[key] = new ProcessSemaphoreInfo(key, incrementBy, limit);
        }