⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.cs

📁 线程池实例,1.1版本,用于代替.net自带线程池
💻 CS
📖 第 1 页 / 共 3 页
字号:
			// 
			this.spinMinThreads.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
			this.spinMinThreads.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.spinMinThreads.Location = new System.Drawing.Point(8, 256);
			this.spinMinThreads.Name = "spinMinThreads";
			this.spinMinThreads.Size = new System.Drawing.Size(88, 29);
			this.spinMinThreads.TabIndex = 13;
			this.spinMinThreads.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
			this.spinMinThreads.ValueChanged += new System.EventHandler(this.spinMinThreads_ValueChanged);
			// 
			// spinInterval
			// 
			this.spinInterval.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
			this.spinInterval.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.spinInterval.Increment = new System.Decimal(new int[] {
																		   100,
																		   0,
																		   0,
																		   0});
			this.spinInterval.Location = new System.Drawing.Point(240, 256);
			this.spinInterval.Maximum = new System.Decimal(new int[] {
																		 100000,
																		 0,
																		 0,
																		 0});
			this.spinInterval.Name = "spinInterval";
			this.spinInterval.Size = new System.Drawing.Size(88, 29);
			this.spinInterval.TabIndex = 16;
			this.spinInterval.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
			this.spinInterval.Value = new System.Decimal(new int[] {
																	   100,
																	   0,
																	   0,
																	   0});
			// 
			// lblThreadInUse
			// 
			this.lblThreadInUse.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.lblThreadInUse.Location = new System.Drawing.Point(80, 40);
			this.lblThreadInUse.Name = "lblThreadInUse";
			this.lblThreadInUse.Size = new System.Drawing.Size(80, 24);
			this.lblThreadInUse.TabIndex = 18;
			this.lblThreadInUse.Text = "XXXXXXXXX";
			this.lblThreadInUse.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
			// 
			// label7
			// 
			this.label7.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label7.Location = new System.Drawing.Point(8, 40);
			this.label7.Name = "label7";
			this.label7.Size = new System.Drawing.Size(80, 24);
			this.label7.TabIndex = 17;
			this.label7.Text = "Used (Green)";
			this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
			// 
			// timerPoll
			// 
			this.timerPoll.Interval = 500;
			this.timerPoll.Tick += new System.EventHandler(this.timer1_Tick);
			// 
			// spinConsumingTime
			// 
			this.spinConsumingTime.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
			this.spinConsumingTime.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.spinConsumingTime.Increment = new System.Decimal(new int[] {
																				100,
																				0,
																				0,
																				0});
			this.spinConsumingTime.Location = new System.Drawing.Point(240, 288);
			this.spinConsumingTime.Maximum = new System.Decimal(new int[] {
																			  100000,
																			  0,
																			  0,
																			  0});
			this.spinConsumingTime.Name = "spinConsumingTime";
			this.spinConsumingTime.Size = new System.Drawing.Size(88, 29);
			this.spinConsumingTime.TabIndex = 20;
			this.spinConsumingTime.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
			this.spinConsumingTime.Value = new System.Decimal(new int[] {
																			100,
																			0,
																			0,
																			0});
			// 
			// label6
			// 
			this.label6.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
			this.label6.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label6.Location = new System.Drawing.Point(336, 290);
			this.label6.Name = "label6";
			this.label6.Size = new System.Drawing.Size(216, 24);
			this.label6.TabIndex = 19;
			this.label6.Text = "Work item consuming time (milliseconds)";
			this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
			// 
			// lblWaitingCallbacks
			// 
			this.lblWaitingCallbacks.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.lblWaitingCallbacks.Location = new System.Drawing.Point(64, 16);
			this.lblWaitingCallbacks.Name = "lblWaitingCallbacks";
			this.lblWaitingCallbacks.Size = new System.Drawing.Size(80, 24);
			this.lblWaitingCallbacks.TabIndex = 22;
			this.lblWaitingCallbacks.Text = "XXXXXXXXX";
			this.lblWaitingCallbacks.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
			// 
			// label9
			// 
			this.label9.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label9.Location = new System.Drawing.Point(8, 16);
			this.label9.Name = "label9";
			this.label9.Size = new System.Drawing.Size(48, 24);
			this.label9.TabIndex = 21;
			this.label9.Text = "Queued";
			this.label9.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
			// 
			// label8
			// 
			this.label8.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label8.Location = new System.Drawing.Point(8, 40);
			this.label8.Name = "label8";
			this.label8.Size = new System.Drawing.Size(64, 24);
			this.label8.TabIndex = 25;
			this.label8.Text = "Generated";
			this.label8.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
			// 
			// label10
			// 
			this.label10.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label10.Location = new System.Drawing.Point(8, 64);
			this.label10.Name = "label10";
			this.label10.Size = new System.Drawing.Size(64, 24);
			this.label10.TabIndex = 26;
			this.label10.Text = "Completed";
			this.label10.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
			// 
			// lblWorkItemsGenerated
			// 
			this.lblWorkItemsGenerated.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.lblWorkItemsGenerated.Location = new System.Drawing.Point(64, 40);
			this.lblWorkItemsGenerated.Name = "lblWorkItemsGenerated";
			this.lblWorkItemsGenerated.Size = new System.Drawing.Size(80, 24);
			this.lblWorkItemsGenerated.TabIndex = 27;
			this.lblWorkItemsGenerated.Text = "XXXXXXXXX";
			this.lblWorkItemsGenerated.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
			// 
			// lblWorkItemsCompleted
			// 
			this.lblWorkItemsCompleted.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.lblWorkItemsCompleted.Location = new System.Drawing.Point(64, 64);
			this.lblWorkItemsCompleted.Name = "lblWorkItemsCompleted";
			this.lblWorkItemsCompleted.Size = new System.Drawing.Size(80, 24);
			this.lblWorkItemsCompleted.TabIndex = 28;
			this.lblWorkItemsCompleted.Text = "XXXXXXXXX";
			this.lblWorkItemsCompleted.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
			// 
			// groupBox2
			// 
			this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
			this.groupBox2.Controls.Add(this.lblWaitingCallbacks);
			this.groupBox2.Controls.Add(this.label9);
			this.groupBox2.Controls.Add(this.label8);
			this.groupBox2.Controls.Add(this.label10);
			this.groupBox2.Controls.Add(this.lblWorkItemsGenerated);
			this.groupBox2.Controls.Add(this.lblWorkItemsCompleted);
			this.groupBox2.Location = new System.Drawing.Point(8, 144);
			this.groupBox2.Name = "groupBox2";
			this.groupBox2.Size = new System.Drawing.Size(152, 96);
			this.groupBox2.TabIndex = 33;
			this.groupBox2.TabStop = false;
			this.groupBox2.Text = "Work items";
			// 
			// groupBox3
			// 
			this.groupBox3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
			this.groupBox3.Controls.Add(this.lblThreadInUse);
			this.groupBox3.Controls.Add(this.label7);
			this.groupBox3.Controls.Add(this.lblThreadsInPool);
			this.groupBox3.Controls.Add(this.label2);
			this.groupBox3.Location = new System.Drawing.Point(176, 144);
			this.groupBox3.Name = "groupBox3";
			this.groupBox3.Size = new System.Drawing.Size(168, 72);
			this.groupBox3.TabIndex = 34;
			this.groupBox3.TabStop = false;
			this.groupBox3.Text = "Threads";
			// 
			// groupBox1
			// 
			this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
				| System.Windows.Forms.AnchorStyles.Left)));
			this.groupBox1.Controls.Add(this.usageThreadsInPool);
			this.groupBox1.Location = new System.Drawing.Point(8, 8);
			this.groupBox1.Name = "groupBox1";
			this.groupBox1.Size = new System.Drawing.Size(80, 128);
			this.groupBox1.TabIndex = 35;
			this.groupBox1.TabStop = false;
			this.groupBox1.Text = "STP Usage";
			// 
			// usageThreadsInPool
			// 
			this.usageThreadsInPool.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
				| System.Windows.Forms.AnchorStyles.Left) 
				| System.Windows.Forms.AnchorStyles.Right)));
			this.usageThreadsInPool.BackColor = System.Drawing.Color.Black;
			this.usageThreadsInPool.Location = new System.Drawing.Point(20, 16);
			this.usageThreadsInPool.Maximum = 25;
			this.usageThreadsInPool.Name = "usageThreadsInPool";
			this.usageThreadsInPool.Size = new System.Drawing.Size(41, 104);
			this.usageThreadsInPool.TabIndex = 37;
			this.usageThreadsInPool.Value1 = 1;
			this.usageThreadsInPool.Value2 = 24;
			// 
			// groupBox4
			// 
			this.groupBox4.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
				| System.Windows.Forms.AnchorStyles.Left) 
				| System.Windows.Forms.AnchorStyles.Right)));
			this.groupBox4.Controls.Add(this.usageHistorySTP);
			this.groupBox4.Location = new System.Drawing.Point(104, 8);
			this.groupBox4.Name = "groupBox4";
			this.groupBox4.Size = new System.Drawing.Size(494, 128);
			this.groupBox4.TabIndex = 36;
			this.groupBox4.TabStop = false;
			this.groupBox4.Text = "STP Usage History";
			// 
			// usageHistorySTP
			// 
			this.usageHistorySTP.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
				| System.Windows.Forms.AnchorStyles.Left) 
				| System.Windows.Forms.AnchorStyles.Right)));
			this.usageHistorySTP.BackColor = System.Drawing.Color.Black;
			this.usageHistorySTP.Location = new System.Drawing.Point(8, 16);
			this.usageHistorySTP.Maximum = 100;
			this.usageHistorySTP.Name = "usageHistorySTP";
			this.usageHistorySTP.Size = new System.Drawing.Size(480, 104);
			this.usageHistorySTP.TabIndex = 0;
			// 
			// pcActiveThreads
			// 
			this.pcActiveThreads.CategoryName = "SmartThreadPool";
			this.pcActiveThreads.CounterName = "Active threads";
			this.pcActiveThreads.InstanceName = "Test SmartThreadPool";
			// 
			// pcInUseThreads
			// 
			this.pcInUseThreads.CategoryName = "SmartThreadPool";
			this.pcInUseThreads.CounterName = "In use threads";
			this.pcInUseThreads.InstanceName = "Test SmartThreadPool";
			// 
			// pcQueuedWorkItems
			// 
			this.pcQueuedWorkItems.CategoryName = "SmartThreadPool";
			this.pcQueuedWorkItems.CounterName = "Work Items in queue";
			this.pcQueuedWorkItems.InstanceName = "Test SmartThreadPool";
			// 
			// pcCompletedWorkItems
			// 
			this.pcCompletedWorkItems.CategoryName = "SmartThreadPool";
			this.pcCompletedWorkItems.CounterName = "Work Items processed";
			this.pcCompletedWorkItems.InstanceName = "Test SmartThreadPool";
			// 
			// Form1
			// 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -