private void startInvokerPool()
{
int threadCount;
if (this._fileTransporterRequest.IsSetFilePath() && !(_s3Client is AmazonS3EncryptionClient))
{
threadCount = this._config.NumberOfUploadThreads;
}
else
{
threadCount = 1; // When using streams or encryption, multiple threads can not be used to read from the same stream.
}
if (this._totalNumberOfParts < threadCount)
{
threadCount = this._totalNumberOfParts;
}
this._executedThreads = new Thread[threadCount];
this._invokers = new UploadPartInvoker[threadCount];
for (int i = 0; i < threadCount; i++)
{
this._invokers[i] = new UploadPartInvoker(this);
Thread thread = new Thread(new ThreadStart(this._invokers[i].Execute));
thread.Name = "Uploader " + i;
thread.IsBackground = true;
this._executedThreads[i] = thread;
thread.Start();
}
}