File tree Expand file tree Collapse file tree
Multithreading-using-parallel-process-in-.NET
Multithreading-using-tasks-in-.NET Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,12 +13,12 @@ static void Main(string[] args)
1313 {
1414 Console . WriteLine ( "Task {0} started" , count ) ;
1515 //Create multiple PDF document, one document on each thread.
16- OpenPDFAndSaveImage ( count ) ;
16+ ConvertPdfToImage ( count ) ;
1717 Console . WriteLine ( "Task {0} is done" , count ) ;
1818 } ) ;
1919 }
2020 //Open and save a PDF document using multi-threading.
21- static void OpenPDFAndSaveImage ( int count )
21+ static void ConvertPdfToImage ( int count )
2222 {
2323 using ( FileStream inputStream = new FileStream ( @"Data/Input.pdf" , FileMode . Open , FileAccess . Read ) )
2424 {
Original file line number Diff line number Diff line change @@ -12,14 +12,14 @@ public static async Task Main()
1212 Task [ ] tasks = new Task [ TaskCount ] ;
1313 for ( int i = 0 ; i < TaskCount ; i ++ )
1414 {
15- tasks [ i ] = Task . Run ( ( ) => OpenPDFAndSaveImage ( ) ) ;
15+ tasks [ i ] = Task . Run ( ( ) => ConvertPdfToImage ( ) ) ;
1616 }
1717 //Ensure all tasks complete by waiting on each task.
1818 await Task . WhenAll ( tasks ) ;
1919 }
2020
2121 //Open a PDF document and save image using multi-threading.
22- static void OpenPDFAndSaveImage ( )
22+ static void ConvertPdfToImage ( )
2323 {
2424 using ( FileStream inputStream = new FileStream ( @"Data/Input.pdf" , FileMode . Open , FileAccess . Read ) )
2525 {
You can’t perform that action at this time.
0 commit comments