示例#1
0
 /// <summary>
 ///  Waits until the thread routine has returned (if it hasn't yet) to thread is
 ///  certain to be disposed.
 ///  Then releases any resources associated with the performance thread object
 ///  including locks, mutexes and the queue.
 /// </summary>
 /// <param name="disposing"></param>
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (m_queue != null)
         {
             m_queue.Clear();
         }
         if (m_queueLock != null)
         {
             m_queueLock.Dispose();
         }
         if (m_pauseLock != null)
         {
             m_pauseLock.Dispose();
         }
         if (m_flushLock != null)
         {
             m_flushLock.Dispose();
         }
         if (m_performanceThread != null)
         {
             m_performanceThread.Dispose();
         }
         m_queueLock         = null;
         m_pauseLock         = null;
         m_flushLock         = null;
         m_performanceThread = null;
         m_queue             = null;
     }
 }
示例#2
0
        /**
         * \addtogroup PERFTHREAD
         * @{
         */

        /// <summary>
        /// Constructor for creating a performance thread.
        /// </summary>
        /// <param name="csound"></param>
        public Csound6PerformanceThread(Csound6NetRealtime csound)
        {
            m_csound    = csound;
            IsPaused    = true;
            IsRunning   = false;
            Status      = CsoundStatus.MemoryAllocationFailure;
            m_queue     = new Queue <Csound6PerfThreadMessage>();
            m_queueLock = new Csound6Mutex();
            if (m_queueLock != null)
            {
                m_pauseLock = new Csound6ThreadLock();
            }
            if (m_pauseLock != null)
            {
                m_flushLock = new Csound6ThreadLock();
            }
            if (m_flushLock != null)
            {
                Status = CsoundStatus.Success;
            }
        }