@@ -106,36 +106,58 @@ private async void start_Click(object sender, RoutedEventArgs e)
106
106
OutputMsg ( "WaitingWorkCount: " + powerPool . WaitingWorkCount ) ;
107
107
if ( runCount != powerPool . WaitingWorkCount )
108
108
{
109
+ if ( runCount != powerPool . WaitingWorkCount )
110
+ {
111
+ OutputMsg ( "error0: runCount != powerPool.WaitingWorkCount" ) ;
112
+ }
109
113
break ;
110
114
}
111
115
112
116
powerPool . Start ( ) ;
113
- OutputMsg ( "Running... AliveWorkerCount: " + powerPool . AliveWorkerCount + " | RunningWorkerCount: " + powerPool . RunningWorkerCount ) ;
117
+ OutputMsg ( "Running... AliveWorkerCount: " + powerPool . AliveWorkerCount + " | RunningWorkerCount: " + powerPool . RunningWorkerCount + " | IdleWorkerCount: " + powerPool . IdleWorkerCount ) ;
114
118
115
119
int r1 = random . Next ( 0 , 101 ) ;
116
- if ( r1 >= 97 && r1 <= 100 )
120
+ if ( r1 >= 81 && r1 <= 100 )
117
121
{
118
122
OutputMsg ( "Stopping..." ) ;
119
123
await powerPool . StopAsync ( ) ;
120
124
OutputMsg ( "AliveWorkerCount: " + powerPool . AliveWorkerCount + " | RunningWorkerCount: " + powerPool . RunningWorkerCount ) ;
125
+ OutputMsg ( "IdleWorkerCount: " + powerPool . IdleWorkerCount ) ;
121
126
OutputMsg ( "WaitingWorkCount: " + powerPool . WaitingWorkCount ) ;
122
127
OutputMsg ( "FailedWorkCount: " + powerPool . FailedWorkCount ) ;
123
128
OutputMsg ( "DoneCount: " + doneCount ) ;
124
129
if ( powerPool . RunningWorkerCount > 0 || powerPool . WaitingWorkCount > 0 )
125
130
{
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
+ }
126
139
break ;
127
140
}
128
141
}
129
- else if ( r1 >= 93 && r1 <= 96 )
142
+ else if ( r1 >= 61 && r1 <= 80 )
130
143
{
131
144
OutputMsg ( "Force Stopping..." ) ;
132
145
await powerPool . StopAsync ( true ) ;
133
146
OutputMsg ( "AliveWorkerCount: " + powerPool . AliveWorkerCount + " | RunningWorkerCount: " + powerPool . RunningWorkerCount ) ;
147
+ OutputMsg ( "IdleWorkerCount: " + powerPool . IdleWorkerCount ) ;
134
148
OutputMsg ( "WaitingWorkCount: " + powerPool . WaitingWorkCount ) ;
135
149
OutputMsg ( "FailedWorkCount: " + powerPool . FailedWorkCount ) ;
136
150
OutputMsg ( "DoneCount: " + doneCount ) ;
137
151
if ( powerPool . RunningWorkerCount > 0 || powerPool . WaitingWorkCount > 0 )
138
152
{
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
+ }
139
161
break ;
140
162
}
141
163
}
@@ -144,11 +166,24 @@ private async void start_Click(object sender, RoutedEventArgs e)
144
166
OutputMsg ( "Waiting..." ) ;
145
167
await powerPool . WaitAsync ( ) ;
146
168
OutputMsg ( "AliveWorkerCount: " + powerPool . AliveWorkerCount + " | RunningWorkerCount: " + powerPool . RunningWorkerCount ) ;
169
+ OutputMsg ( "IdleWorkerCount: " + powerPool . IdleWorkerCount ) ;
147
170
OutputMsg ( "WaitingWorkCount: " + powerPool . WaitingWorkCount ) ;
148
171
OutputMsg ( "FailedWorkCount: " + powerPool . FailedWorkCount ) ;
149
172
OutputMsg ( "DoneCount: " + doneCount ) ;
150
173
if ( powerPool . RunningWorkerCount > 0 || powerPool . WaitingWorkCount > 0 || runCount != doneCount )
151
174
{
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
+ }
152
187
break ;
153
188
}
154
189
}
0 commit comments