Esempio n. 1
0
        public T Use <T>(Func <T, bool> setup)
            where T : IModel, new()
        {
            var instance = Use <T>();

            if (instance != null)
            {
                if (!setup(instance))
                {
                    Diagnose.TraceError(
                        "Runtime", "Use", "setup error");
                }
            }
            return(instance);
        }
Esempio n. 2
0
 /// <summary>
 /// commit without any guards
 /// </summary>
 protected void InnerCommit()
 {
     if (Disposed)
     {
         return;
     }
     if (cache_commit_ != null)
     {
         try {
             cache_commit_(data_);
         } catch (Exception ex) {
             Diagnose.TraceError(
                 "Cache", "InnerCommit", ex.Message);
         }
         ticks_ = 0;
     }
 }
Esempio n. 3
0
        private void Routine()
        {
            Action job = null;

            if (jobs_.Count != 0)
            {
                job = jobs_.Pull();
            }
            if (job == null)
            {
                Thread.Sleep(50);
            }
            else
            {
                try {
                    job();
                } catch (Exception ex) {
                    Diagnose.TraceError(
                        "Worker", "Routine", ex.Message);
                }
            }
        }