25.12.2015 Views

Professional

1l6xhbR

1l6xhbR

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Canceling tasks and handling exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . .543<br />

The mechanics of cooperative cancellation . . . . . . . . . . . . . . . . . . .543<br />

Using continuations with canceled and faulted tasks . . . . . . . . . . .556<br />

Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .557<br />

Quick reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .557<br />

Chapter 24 Improving response time by performing<br />

asynchronous operations 559<br />

Implementing asynchronous methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . .560<br />

Defining asynchronous methods: The problem . . . . . . . . . . . . . . . .560<br />

Defining asynchronous methods: The solution . . . . . . . . . . . . . . . .564<br />

Defining asynchronous methods that return values . . . . . . . . . . . .569<br />

Asynchronous method gotchas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .570<br />

Asynchronous methods and the Windows Runtime APIs . . . . . . . .572<br />

Using PLINQ to parallelize declarative data access . . . . . . . . . . . . . . . . . . .575<br />

Using PLINQ to improve performance while iterating<br />

through a collection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .576<br />

Canceling a PLINQ query . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .580<br />

Synchronizing concurrent access to data . . . . . . . . . . . . . . . . . . . . . . . . . . .581<br />

Locking data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .584<br />

Synchronization primitives for coordinating tasks . . . . . . . . . . . . . .584<br />

Canceling synchronization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .587<br />

The concurrent collection classes . . . . . . . . . . . . . . . . . . . . . . . . . . . .587<br />

Using a concurrent collection and a lock to implement<br />

thread-safe data access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .588<br />

Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .598<br />

Quick reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .599<br />

Chapter 25 Implementing the user interface for a Universal<br />

Windows Platform app 601<br />

Features of a Universal Windows Platform app . . . . . . . . . . . . . . . . . . . . . .602<br />

Using the Blank App template to build a Universal Windows<br />

Platform app . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .605<br />

xvi<br />

Contents

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!