Exemplo n.º 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;
     }
 }
Exemplo n.º 2
0
        /**
         * @}
         */

        /********************************************************************************************************/

        /*
         * Initiates the performance thread.  csPerfThread starts thread in constructor, but in C#,
         * this won't work because this class passes itself as user data and "this" pointers
         * can't be pinned in memory until the constructor completes.
         * We call it conditionally when Play() is called instead.
         */
        private bool StartPerformanceThread()
        {
            if (m_performanceThread == null)
            {
                m_performanceThread = new Csound6NetThread(this, this);
            }
            IsRunning = ((m_performanceThread != null) && m_performanceThread.IsRunning);
            return(IsRunning);
        }