Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
govert committed Mar 21, 2015
1 parent a5e3338 commit 95e973f
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions LimitedConcurrencyAsync/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
LimitedConcurrencyAsync sample
---
#LimitedConcurrencyAsync sample

This sample shows how the async function support can be customised by using the .NET 4 Task-based functionality.
In particular, we create a limited concurrency scheduler, that will restrict the number of async threads that are used to run Tasks.
Expand All @@ -10,21 +9,21 @@ When running, there should be two new functions in Excel - "Sleep" and "SleepPer

Some details on the code:

* AsyncFunctions.cs
## AsyncFunctions.cs

This is the user code part of the sample. A custom TaskScheduler and related TaskFactory is initialized, and some async Excel-DNA functions defined that will create Tasks using that TaskFactory.

There are two versions of the Sleep function:
** Sleep - different calls to Sleep with the same timeout parameter will be combined and run as the same Task.
** SleepPerCell - calls from different cells will create separate Task, making the concurrency behaviour easier to see.
* Sleep - different calls to Sleep with the same timeout parameter will be combined and run as the same Task.
* SleepPerCall - calls from different cells will create separate Task, making the concurrency behaviour easier to see.

* AsyncTaskUtil.cs
## AsyncTaskUtil.cs

This file contains some helpers to integrate the Task-based API with Excel-DNA async support. The main helper function is AsyncTaskUtil, which takes the async call identifiers (the callerFunctionName and callerParameters) as well as an Action<Task> that will create the async Task on the first call. Internally, an ExcelTaskObservable is created, which converts the Task completion result into the appropriate IObservable interface to register with Excel-DNA.

There is also an overload that supports cancellation.

* LimitedConcurrencyLevelTaskScheduler.cs
## LimitedConcurrencyLevelTaskScheduler.cs

This file is taken from the "Samples for Parallel Programming" on MSDN (https://code.msdn.microsoft.com/Samples-for-Parallel-b4b76364/sourcecode?fileId=44488&pathId=2044791305). There are a number of custom TaskScheduler samples, including a very flexible QueuedTaskScheduler. The TaskScheduler samples are discussed in detail by Stephen Taub here: http://blogs.msdn.com/b/pfxteam/archive/2010/04/09/9990424.aspx .

Expand Down

0 comments on commit 95e973f

Please sign in to comment.