示例#1
0
        private void SignalConsumerForWork(MySession mySession)
        {
            mySession.ProducerThread = Thread.CurrentThread;
            mySession.TaskQIsEmtpty = false;
            mySession.HasWaitingProducer = false;
            UpdateMySession(mySession);

            Monitor.PulseAll(mySession);
        }
示例#2
0
 /// <summary>
 /// Task Queue must be updated if queue is produced.
 /// </summary>
 /// <param name="mySession"></param>
 private void UpdateMySession(MySession mySession)
 {
     Application.Lock();
     ConcurrentDictionary<string, MySession> applicationSessions = Application["MTA-Sessions"] as ConcurrentDictionary<string, MySession>;
     if (applicationSessions != null)
     {
         applicationSessions[mySession.SessionId] = mySession;
     }
     Application["MTA-Sessions"] = applicationSessions;
     Application.UnLock();
 }
示例#3
0
 /// <summary>
 /// Task Queue must be updated if queue is produced.
 /// </summary>
 /// <param name="mySession"></param>
 /// <param name="isEmpty"></param>
 private void UpdateTaskQReadyStatus(MySession mySession, bool isEmpty)
 {
     Application.Lock();
     ConcurrentDictionary<string, MySession> applicationSessions = Application["MTA-Sessions"] as ConcurrentDictionary<string, MySession>;
     if (applicationSessions != null)
         applicationSessions[mySession.SessionId].TaskQIsEmtpty = isEmpty;//there are 30 tasks to do OR not...
     Application["MTA-Sessions"] = applicationSessions;
     Application.UnLock();
 }