コード例 #1
0
 public ApiWorkerThread(StatsApi api, Queue <HttpListenerContext> queue, ManualResetEvent ready, ManualResetEvent stop)
 {
     _api         = api;
     _queue       = queue;
     _ready       = ready;
     _stop        = stop;
     this._thread = new Thread(this.Worker);
 }
コード例 #2
0
        public StatServer(int maxThreads)
        {
            _statsApi = new StatsApi(new SqliteAdapter(), true);

            //_workers = new Thread[maxThreads];
            _workers        = new ApiWorkerThread[maxThreads];
            _queue          = new Queue <HttpListenerContext>();
            _stop           = new ManualResetEvent(false);
            _ready          = new ManualResetEvent(false);
            _listener       = new HttpListener();
            _listenerThread = new Thread(this.HandleRequests);
        }