コード例 #1
0
        static void Main(string[] args)
        {
            // Print processing statistics in a separate thread
            Timer timer = new Timer(PrintStatistics, null, TimeSpan.Zero, TimeSpan.FromSeconds(1));

            // Handle an infinite stream of requests
            while (!Console.KeyAvailable)
            {
                Request request = Request.NextRequest();
                Response response = new Response(request);
                response.Send();
                Interlocked.Increment(ref _requestsProcessed);
            }

            GC.KeepAlive(timer);
        }
コード例 #2
0
 public static void Add(Response response)
 {
     _cache.Add(response);
 }