Skip to content

Commit 85ac276

Browse files
committed
update
1 parent 64a2f85 commit 85ac276

File tree

1 file changed

+38
-3
lines changed

1 file changed

+38
-3
lines changed

PowerThreadPoolTest/MainWindow.xaml.cs

+38-3
Original file line numberDiff line numberDiff line change
@@ -106,36 +106,58 @@ private async void start_Click(object sender, RoutedEventArgs e)
106106
OutputMsg("WaitingWorkCount: " + powerPool.WaitingWorkCount);
107107
if (runCount != powerPool.WaitingWorkCount)
108108
{
109+
if (runCount != powerPool.WaitingWorkCount)
110+
{
111+
OutputMsg("error0: runCount != powerPool.WaitingWorkCount");
112+
}
109113
break;
110114
}
111115

112116
powerPool.Start();
113-
OutputMsg("Running... AliveWorkerCount: " + powerPool.AliveWorkerCount + " | RunningWorkerCount: " + powerPool.RunningWorkerCount);
117+
OutputMsg("Running... AliveWorkerCount: " + powerPool.AliveWorkerCount + " | RunningWorkerCount: " + powerPool.RunningWorkerCount + " | IdleWorkerCount: " + powerPool.IdleWorkerCount);
114118

115119
int r1 = random.Next(0, 101);
116-
if (r1 >= 97 && r1 <= 100)
120+
if (r1 >= 81 && r1 <= 100)
117121
{
118122
OutputMsg("Stopping...");
119123
await powerPool.StopAsync();
120124
OutputMsg("AliveWorkerCount: " + powerPool.AliveWorkerCount + " | RunningWorkerCount: " + powerPool.RunningWorkerCount);
125+
OutputMsg("IdleWorkerCount: " + powerPool.IdleWorkerCount);
121126
OutputMsg("WaitingWorkCount: " + powerPool.WaitingWorkCount);
122127
OutputMsg("FailedWorkCount: " + powerPool.FailedWorkCount);
123128
OutputMsg("DoneCount: " + doneCount);
124129
if (powerPool.RunningWorkerCount > 0 || powerPool.WaitingWorkCount > 0)
125130
{
131+
if (powerPool.RunningWorkerCount > 0)
132+
{
133+
OutputMsg("error1: powerPool.RunningWorkerCount > 0" + " - " + powerPool.RunningWorkerCount);
134+
}
135+
if (powerPool.WaitingWorkCount > 0)
136+
{
137+
OutputMsg("error1: powerPool.WaitingWorkCount > 0" + " - " + powerPool.WaitingWorkCount);
138+
}
126139
break;
127140
}
128141
}
129-
else if (r1 >= 93 && r1 <= 96)
142+
else if (r1 >= 61 && r1 <= 80)
130143
{
131144
OutputMsg("Force Stopping...");
132145
await powerPool.StopAsync(true);
133146
OutputMsg("AliveWorkerCount: " + powerPool.AliveWorkerCount + " | RunningWorkerCount: " + powerPool.RunningWorkerCount);
147+
OutputMsg("IdleWorkerCount: " + powerPool.IdleWorkerCount);
134148
OutputMsg("WaitingWorkCount: " + powerPool.WaitingWorkCount);
135149
OutputMsg("FailedWorkCount: " + powerPool.FailedWorkCount);
136150
OutputMsg("DoneCount: " + doneCount);
137151
if (powerPool.RunningWorkerCount > 0 || powerPool.WaitingWorkCount > 0)
138152
{
153+
if (powerPool.RunningWorkerCount > 0)
154+
{
155+
OutputMsg("error2: powerPool.RunningWorkerCount > 0" + " - " + powerPool.RunningWorkerCount);
156+
}
157+
if (powerPool.WaitingWorkCount > 0)
158+
{
159+
OutputMsg("error2: powerPool.WaitingWorkCount > 0" + " - " + powerPool.WaitingWorkCount);
160+
}
139161
break;
140162
}
141163
}
@@ -144,11 +166,24 @@ private async void start_Click(object sender, RoutedEventArgs e)
144166
OutputMsg("Waiting...");
145167
await powerPool.WaitAsync();
146168
OutputMsg("AliveWorkerCount: " + powerPool.AliveWorkerCount + " | RunningWorkerCount: " + powerPool.RunningWorkerCount);
169+
OutputMsg("IdleWorkerCount: " + powerPool.IdleWorkerCount);
147170
OutputMsg("WaitingWorkCount: " + powerPool.WaitingWorkCount);
148171
OutputMsg("FailedWorkCount: " + powerPool.FailedWorkCount);
149172
OutputMsg("DoneCount: " + doneCount);
150173
if (powerPool.RunningWorkerCount > 0 || powerPool.WaitingWorkCount > 0 || runCount != doneCount)
151174
{
175+
if (powerPool.RunningWorkerCount > 0)
176+
{
177+
OutputMsg("error3: powerPool.RunningWorkerCount > 0" + " - " + powerPool.RunningWorkerCount);
178+
}
179+
if (powerPool.WaitingWorkCount > 0)
180+
{
181+
OutputMsg("error3: powerPool.WaitingWorkCount > 0" + " - " + powerPool.WaitingWorkCount);
182+
}
183+
if (runCount != doneCount)
184+
{
185+
OutputMsg("error3: runCount != doneCount");
186+
}
152187
break;
153188
}
154189
}

0 commit comments

Comments
 (0)