Fix missing event PoolJobFinished, cleanup
parent
0d2d128b5f
commit
42f330381e
|
@ -41,12 +41,6 @@ namespace ln.types.threads
|
|||
|
||||
private Queue<PoolJob> queuedJobs = new Queue<PoolJob>();
|
||||
|
||||
|
||||
private bool stopping;
|
||||
private int releaseThreads = 0;
|
||||
|
||||
private Thread supervisorThread;
|
||||
|
||||
public Pool() : this(Environment.ProcessorCount){}
|
||||
public Pool(int numThreads)
|
||||
{
|
||||
|
@ -58,12 +52,12 @@ namespace ln.types.threads
|
|||
if ((State == PoolState.RUN) || (State == PoolState.SHUTDOWN))
|
||||
throw new NotSupportedException("Pool can only be started if not running");
|
||||
|
||||
State = PoolState.RUN;
|
||||
|
||||
for (int n = 0; n < PoolSize; n++)
|
||||
{
|
||||
CreatePoolThread();
|
||||
}
|
||||
|
||||
State = PoolState.RUN;
|
||||
}
|
||||
|
||||
public virtual void Stop() => Stop(false);
|
||||
|
@ -217,6 +211,8 @@ namespace ln.types.threads
|
|||
try
|
||||
{
|
||||
poolJob.Run(this);
|
||||
if (PoolJobFinished != null)
|
||||
PoolJobFinished(this,poolJob);
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue