コード例 #1
0
        public void Execute()
        {
            var remaining = new RemainingWorkItem(_countdown, _count);

            for (var j = 0; j < _count; j++)
            {
                _pool.UnsafeQueueUserWorkItem(remaining, _local);
            }
        }
コード例 #2
0
 public void HeliosBenchmark(IThreadPool <IThreadPoolWorkItem> pool, Counts counts)
 {
     using (var mre = new CountdownEvent(1))
     {
         var workItem = new RemainingWorkItem(mre, counts.Items);
         for (long i = 0; i < counts.Items; i++)
         {
             pool.UnsafeQueueUserWorkItem(workItem, false);
         }
         mre.Wait();
     }
 }
コード例 #3
0
        public void Global_02_FullLoad(IThreadPool <IThreadPoolWorkItem> pool, Counts counts)
        {
            for (var j = 0; j < counts.Iterations; j++)
            {
                using var countdown = new CountdownEvent(1);
                var remaining = new RemainingWorkItem(countdown, counts.Items);

                for (var i = 0; i < counts.Items; i++)
                {
                    pool.UnsafeQueueUserWorkItem(remaining, false);
                }

                countdown.Wait();
            }

            DrainQueues(pool);
        }
コード例 #4
0
        public void Global_01_PartialLoad(IThreadPool <IThreadPoolWorkItem> pool, Counts counts)
        {
            for (var j = 0; j < counts.Iterations; j++)
            {
                using var countdown = new CountdownEvent(1);
                var signal = new RemainingWorkItem(countdown, counts.Items);

                for (var i = 0; i < counts.Items; i++)
                {
                    pool.UnsafeQueueUserWorkItem(signal, false);
                }

                countdown.Wait();
            }

            // TODO: Item adding is single threaded here
            DrainQueues(pool);
        }