Beispiel #1
0
        public IAsyncResult BeginOpen(AsyncCallback callback)
        {
            if (m_thread != null)
            {
                return(new ValueAsyncResult(null, new ConnectionException("Opening allready opened connection ")));
            }

            m_breakFlag = false;
            WasUsed     = true;
            m_thread    = new Thread(Run);
            if (ThreadName != null)
            {
                m_thread.Name = ThreadName;
            }
            m_queue = new WaitQueue <QElement>();
            m_thread.Start();
            return(this.BeginInvoke((Action)DoCallOpen, callback));
        }
Beispiel #2
0
 public void EndClose(IAsyncResult async)
 {
     if (m_thread != null)
     {
         m_thread.Join(100);
         if (m_thread.IsAlive)
         {
             ThreadRegister.MarkThreadDefinitivelyAborted(m_thread);
             m_thread.Abort();
         }
     }
     m_thread       = null;
     m_breakStarted = false;
     m_queue        = null;
     if (async is KillObject)
     {
         ((KillObject)async).EndInvoke();
     }
     else
     {
         EndInvoke(async);
     }
 }