C# 5.0 in a Nutshell by Joseph Albahari
Author:Joseph Albahari [Joseph Albahari and Ben Albahari]
Language: eng
Format: epub
Tags: COMPUTERS / Programming Languages / C#
ISBN: 9781449340964
Publisher: O'Reilly Media
Published: 2012-06-19T16:00:00+00:00
Note
You can track a task’s execution status via its Status property.
Wait
Calling Wait on a task blocks until it completes and is the equivalent of calling Join on a thread:
Task task = Task.Run (() => { Thread.Sleep (2000); Console.WriteLine ("Foo"); }); Console.WriteLine (task.IsCompleted); // False task.Wait(); // Blocks until task is complete
Wait lets you optionally specify a timeout and a cancellation token to end the wait early (see Cancellation).
Long-running tasks
By default, the CLR runs tasks on pooled threads, which is ideal for short-running compute-bound work. For longer-running and blocking operations (such as our example above), you can prevent use of a pooled thread as follows:
Task task = Task.Factory.StartNew (() => ..., TaskCreationOptions.LongRunning);
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Coding Theory | Localization |
Logic | Object-Oriented Design |
Performance Optimization | Quality Control |
Reengineering | Robohelp |
Software Development | Software Reuse |
Structured Design | Testing |
Tools | UML |
Deep Learning with Python by François Chollet(12583)
Hello! Python by Anthony Briggs(9919)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(9798)
The Mikado Method by Ola Ellnestam Daniel Brolund(9781)
Dependency Injection in .NET by Mark Seemann(9342)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8304)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7767)
Grails in Action by Glen Smith Peter Ledbrook(7699)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7561)
Becoming a Dynamics 365 Finance and Supply Chain Solution Architect by Brent Dawson(7121)
Microservices with Go by Alexander Shuiskov(6880)
Practical Design Patterns for Java Developers by Miroslav Wengner(6797)
Test Automation Engineering Handbook by Manikandan Sambamurthy(6743)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6420)
Angular Projects - Third Edition by Aristeidis Bampakos(6153)
The Art of Crafting User Stories by The Art of Crafting User Stories(5679)
NetSuite for Consultants - Second Edition by Peter Ries(5611)
Demystifying Cryptography with OpenSSL 3.0 by Alexei Khlebnikov(5422)
Kotlin in Action by Dmitry Jemerov(5070)
