Created
July 8, 2020 09:01
-
-
Save umerfaruk/a493d0c4732957f61aaa9035fab2300e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BlockingCollection<Page> _jobs = new BlockingCollection<Page>(); | |
var tasks = new ConsumerStarter().StartAsyncConsumers(_threadCount, _cancellationToken, DownloadPage); | |
for (var i = 0; i < _pageCount; i++) | |
{ | |
_jobs.Add(new Page { PageId = pageIds[i], PageNumber = Path.GetFileNameWithoutExtension(pages[i]), FileName = pages[i] }); | |
} | |
_jobs.CompleteAdding(); | |
Task.WaitAll(tasks.ToArray(), _cancellationToken); | |
private void DownloadPage() | |
{ | |
..... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment