DEV301. // Synchronous TResult Foo(...); // Asynchronous Programming Model (APM) IAsyncResult BeginFoo(..., AsyncCallback callback, object state);

Slides:



Advertisements
Similar presentations
TechReady 16 4/1/2017 Async Clinic
Advertisements

WSV405. IPv6 Ready Logo Program
SIM201. Announcing… copyright chappellseminars.com some hosts comply; RST = closed no = response open some hosts comply; RST = closed no = response.
Cole Durdan.  What is asynchronous programming?  Previous patterns  Task Based Async Programming .NET 4.5 Keywords  What happens in an async. method?
Stephen Toub Parallel Computing Platform Microsoft Corporation.
WSV304 Manual Deployment High cost Fully Automated Low cost.
OSP303. demo Status Bar Notification.
SIM Separate solution install paths can be taken, stand alone and SCOM integrated. Both require core AVIcode web apps and DB’s.
DBI331. Cube Measure Group Measure Partition Cube Dimension Dimension Attribute Relationship Hierarchy Level Cube Attribute Cube Hierarchy Measure.
DBI209 demo Deploy & Future Proof Monitor & Manage Share & Collaborate Mash-up & Analyze Connect & ProvisionFind & Access.
DBI330. Use the SSRS Execution Log, capture SSAS trace Look for peak times Gather workload usage How many more users? Double estimate just in.
Fun with Scorecards and Indicators Wrap Up & Questions.
DEV309.
SIM346. General information about the software application.
DEV207. SSDT Database Services Database Services Analysis Services Reporting Services Integration Services.
DEV314. Entity Data Model demo Entity Data Model.
DEV202 Before I get started... …is too expensive. …is too complex. …requires a server.
DEV330. NFL Sunday Night Football nbcsports.msnbc.com 3.5Mbps 720p Live smooth streaming Full DVR support 5 simultaneous camera views Instant Replay.
WCL309. Demo.
SIM329. Certificate Enrollment Without CEP/CES Certificate Authority Active Directory Client Workstations LDAP RPC/DCOM.
EXL319. *Baseline for 80,000 user pool with 8 FEs and 1 BE Lync Server 2010 Capacity Calculator released.
WPH203 Content Choice Discoverability demo.
SIM314 Introduction Transport Layer Summary Network Layer.
demo.
COS303. Azure Enterprise CLOUDENTERPRISE Data Synchronization SQL Azure Data Sync Application-layer Connectivity & Messaging Service Bus Security.
EXL318. “The voice diagnostics feature is very popular. In general, having that kind of feedback shows that quality is better overall. I think feedback.
Web Server Database Web Server Web Server Auction Web App Auction Service Items and Bids Items and Bids Cache Session State Checkout Service Payment.
DBI329. video.
DBI326. PhraseGoal “Data Mining”Inform actionable decisions “Machine Learning”Determine best performing algorithm.
WCL308. (While you’re sitting there, sign up for the GPanswers.com Tip of the Week … (Scan a tag.. Fill out the little form…) and enter to win a copy.
DPR302.
2.
DEV331. class Tweet : TimelineItem {…} class DirectMessage : TimelineItem {…} class Notification : TimelineItem {…} … TimelineItem[] items = new.
WCL304.
DPR306. Process and tools Individuals and interactions over Following a plan Responding to change over Source: Comprehensive.
DPR305. Controller Model View Client Business Objects Server Business Objects Data.
OSP402 Required Slide Track PMs will supply the content for this slide, which will be inserted during the final scrub.
DEV211. The simplest way to create business applications for the desktop and the cloud.
DBI325. Monitoring Analytics Support will extend to Analysis Services in the Denali release.
DPR301 demo Executable Requirements.
OSP318. ProfileSynchronizationServiceInstanceProfileSynchronizationServiceInstance Profile Service Instance Instance.
WPH303 announcement demo.
VIR326. Dell Compellent always puts the right data in the right place at the right time at the right cost. That’s Fluid Data.
DEV351.
DEV332. Required Slide Speakers, please list the Breakout Sessions, Interactive Discussions, Labs, Demo Stations and Certification Exam that.
VIR306. VM Memory Host Computer Balloon Disk VM Host Computer Memory Balloon Disk Inflate Swap Out Ballloon Deflate VM Host Computer Memory.
DEV344. NEW VISITORS GROWTH BOUNCE RATE LOSS CONVERSION RATE ORDER VALUE x TIME ON SITE PAGES PER VISIT NUMBER OF VISITS SEARCHES TWEETS MENTIONS.
DEV321. demo Rule: Any slide about UX must be charcoal gray or black.
#TEDEV342 A A B B I currently deploy via FTP directly to my host. My deployment is manual because I need to set permissions on the target server.
Learn more: Download SCM: Join the TechNet Wiki community:
DEV349 Minifig by Dunechaser: Support the
DEV303. Tiny Functions Why Does It Need a Name?
OSP-302. DescriptionUri All lists on a site.../_vti_bin/ListData.svc All Items in a named list.../_vti_bin/ListData.svc/MyList 2nd Item in the list.../_vti_bin/ListData.svc/MyList(2)
TOPICS WHAT YOU’LL LEAVE WITH WHO WILL BENEFIT FROM THIS TALK.NET library developers : with knowledge of async/await in C# / VB interested in low-level.
DEV348. demo Valid HTML5 Syntax demo.
SIM323. Active Directory ? ? ? ? ? ? ? ? ?
WCL402. “While it’s true that Windows ___ sports some impressive technical features, I believe that Windows owes most of its success to the third-
Patterns of Parallel Programming with.NET 4 Stephen Toub Principal Architect Parallel Computing Platform Microsoft Corporation
WSV303. I live here... DC DNS DHCP WDS Clients DC DNS WDS/DHCP DC/DNS.
DEV354. Describe your data Create screens for common tasks Author business logic Customize screen layouts Define custom queries Create custom Silverlight.
SIM End users Web servers Application servers Data servers ? How do I know I have a problem? How do I isolate the problem? How do I diagnose.
WCL301. demo Basic Custom XML-file.
TOPICS WHAT YOU’LL LEAVE WITH WHO WILL BENEFIT FROM THIS TALK.NET developers: familiar with parallel programming support in Visual Studio 2010 and.NET.
About Me AUTHENTICATION Identity Provider.
Async Made Simple in Windows 8, with C# and Visual Basic Alex Turner Program Manager VB/C# Compilers Microsoft Corporation DEV332.

DEV355 Jack Swigert demo my wife demo.
DBI407. Oracle 10g CDF SSAS Cube Builder NAS SSAS Query Servers HW NLB Partition 1 Partition 2 Partition N Partition 1 Partition.
DEV353. Required Slide Speakers, please list the Breakout Sessions, Interactive Discussions, Labs, Demo Stations and Certification.
COS307. demo Required Slide Track PMs will supply the content for this slide, which will be inserted during the final scrub. Website:
Presentation transcript:

DEV301

// Synchronous TResult Foo(...); // Asynchronous Programming Model (APM) IAsyncResult BeginFoo(..., AsyncCallback callback, object state); TResult EndFoo(IAsyncResult asyncResult); // Event-based Asynchronous Pattern (EAP) public void FooAsync(...); public event EventHandler FooCompleted;

public void CopyStreamToStream(Stream source, Stream destination) { byte[] buffer = new byte[0x1000]; int numRead; while ((numRead = source.Read(buffer, 0, buffer.Length)) != 0) { destination.Write(buffer, 0, numRead); } }

public IAsyncResult BeginCopyStreamToStream( Stream source, Stream destination) { var tcs = new TaskCompletionSource (); byte[] buffer = new byte[0x1000]; Action readWriteLoop = null; readWriteLoop = iar => { try { for (bool isRead = iar == null; ; isRead = !isRead) { switch (isRead) { case true: iar = source.BeginRead(buffer, 0, buffer.Length, readResult => { if (readResult.CompletedSynchronously) return; readWriteLoop(readResult); }, null); if (!iar.CompletedSynchronously) return; break; case false: int numRead = source.EndRead(iar); if (numRead == 0) { tcs.TrySetResult(null); return; } iar = destination.BeginWrite(buffer, 0, numRead, writeResult => { if (writeResult.CompletedSynchronously) return; destination.EndWrite(writeResult); readWriteLoop(null); }, null); if (!iar.CompletedSynchronously) return; destination.EndWrite(iar); break; } } } catch (Exception e) { tcs.TrySetException(e); } }; readWriteLoop(null); return tcs.Task; } public void EndCopyStreamToStream(IAsyncResult asyncResult) { ((Task)asyncResult).Wait(); }

public void CopyStreamToStream(Stream source, Stream destination) { byte[] buffer = new byte[0x1000]; int numRead; while ((numRead = source.Read(buffer, 0, buffer.Length)) != 0) { destination.Write(buffer, 0, numRead); } } public async Task CopyStreamToStreamAsync(Stream source, Stream destination) { byte[] buffer = new byte[0x1000]; int numRead; while ((numRead = await source.ReadAsync(buffer, 0, buffer.Length)) != 0) { await destination.WriteAsync(buffer, 0, numRead); } }

// Synchronous TResult Foo(...); // Asynchronous Programming Model (APM) IAsyncResult BeginFoo(..., AsyncCallback callback, object state); TResult EndFoo(IAsyncResult asyncResult); // Event-based Asynchronous Pattern (EAP) public void FooAsync(...); public event EventHandler FooCompleted; // Task-based Asynchronous Pattern (TAP) Task FooAsync(...); System.IO.Stream: Task ReadAsync(...); Task WriteAsync(...); Task FlushAsync(); Task CopyToAsync(...);

demo

ActionBlock Message Queue Process(0);Process(1);Process(2);Process(3); 4 4 Process(4);

IDataflowBlock ISourceBlock (a source of data) ITargetBlock (a target for data) IPropagatorBlock<> (a source and target) Built-in blocks for Buffering and PropagationBuilt-in blocks for ExecutingBuilt-in blocks for Joining

DataflowBlockOptions TaskScheduler MaxMessagesPerTask CancellationToken BoundedCapacity ExecutionDataflowBlockOptions MaxDegreeOfParallelism GroupingDataflowBlockOptions Greedy MaxNumberOfGroups

Sessions On-Demand & CommunityMicrosoft Certification & Training Resources Resources for IT ProfessionalsResources for Developers Connect. Share. Discuss.

Scan the Tag to evaluate this session now on myTechEd Mobile