TAILIEUCHUNG - Apress-Visual CSharp 2010 Recipes A Problem Solution Approach_7

yêu cầu đã trở thành ví dụ này chờ đợi cho tất cả các nhiệm vụ để hoàn thành trước khi có kết quả. sử dụng hệ thống, bằng cách sử dụng ; sử dụng ; không gian tên Recipe15_03 {lớp Recipe15_03 | CHAPTER 15 PARALLEL PROGRAMMING requested became available this example waits for all of the tasks to complete before obtaining the results. using System using using namespace Recipe15_03 . class Recipe15_03 . static void Main string args Press enter to start Create the tasks. Task int task1 Task int . writeDays Task int task2 Task int . writeMonths Task int task3 Task int . writeCities Wait for all of the tasks to complete. task1 task2 task3 Get the results and write them out. 0 days were written 0 months were written 0 cities were written Wait to continue. nMain method complete. Press Enter static int writeDays . . . . string daysArray Monday Tuesday Wednesday Thursday Friday Saturday Sunday foreach string day in daysArray . . . Day of the Week 0 day 500 . . return 735 CHAPTER 15 PARALLEL PROGRAMMING static int writeMonths string monthsArray Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec foreach string month in monthsArray . . Month 0 month 500 . return static int writeCities . string citiesArray London New York Paris Tokyo Sydney foreach string city in citiesArray . . . City 0 city 500 . . return 15-4. Parallel Process a Collection Problem You need to parallel process each element in a collection. Solution Use the method to create a new task to process each of the elements in a collection. Optionally use to limit the degree of parallelism that will be used. How It Works The static method accepts a collection a function delegate and an optional instance of ParallelOptions as

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.