Ejemplo n.º 1
0
        /// <summary>
        /// 打开缓存池
        /// </summary>
        public void Open()
        {
            // 检查是否打开
            if (this.IsOpen)
            {
                throw new ApplicationException("缓冲池已经打开");
            }

            // Create product queue.
            _productQueue = new ThreadSafetyList <TProduct>();

            // Create semaphore
            _cacheSemaphore = new Semaphore(0, Int32.MaxValue);

            // Create work-thread
            _dataHandleThread              = new Thread(new ThreadStart(ThreadEntry));
            _dataHandleThread.Name         = _dataHandleThreadName;
            _dataHandleThread.IsBackground = true;
            _dataHandleThread.Start();
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="__this">ThreadSafetyList类对象</param>
 internal __Enumerator1(ThreadSafetyList <T> __this)
 {
     this.__this = __this;
 }