Skip to content

Commit 712a632

Browse files
author
Jos Hickson
committed
Imported code and tests.
1 parent 156e94c commit 712a632

50 files changed

Lines changed: 4667 additions & 1 deletion

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Ignore everything
2+
*
3+
4+
# Don't ignore directories, so we can recurse into them
5+
!*/
6+
7+
# Except
8+
!.gitattributes
9+
!.gitignore
10+
!.gitconfig
11+
!*.cs
12+
!*.csproj
13+
!*.DotSettings
14+
!*.sln
15+
!*.json
16+
!*.md
17+
!*.snk
18+
bin/
19+
obj/
20+
project.lock.json
21+
/.vs/
22+
/.vscode/

CONTRIBUTING.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# How to contribute
2+
3+
One of the easiest ways to contribute is to participate in discussions and discuss issues. You can also contribute by submitting pull requests with code changes.
4+
5+
## Filing issues
6+
The best way to get your bug fixed is to be as detailed as you can be about the problem.
7+
Providing a minimal project with steps to reproduce the problem is ideal.
8+
Here are questions you can answer before you file a bug to make sure you're not missing any important information.
9+
10+
1. Did you include the snippet of broken code in the issue?
11+
2. What are the *EXACT* steps to reproduce this problem?
12+
3. What package versions are you using (you can see these in the `project.json` file)?
13+
4. What operating system are you using?
14+
15+
GitHub supports [markdown](https://help.github.com/articles/github-flavored-markdown/), so when filing bugs make sure you check the formatting before clicking submit.
16+
17+
## Contributing code and content
18+
Make sure you can build the code and run the tests. Familiarize yourself with the project workflow and our coding conventions. If you don't know what a pull request is read this article: https://help.github.com/articles/using-pull-requests.
19+
20+
Before submitting a feature or substantial code contribution please discuss it with the team and ensure it follows the product roadmap. You might also read these two blog posts on contributing code: [Open Source Contribution Etiquette](http://tirania.org/blog/archive/2010/Dec-31.html) by Miguel de Icaza and [Don't "Push" Your Pull Requests](https://www.igvita.com/2011/12/19/dont-push-your-pull-requests/) by Ilya Grigorik. Note that all code submissions will be rigorously reviewed and tested by the Winton team prior to merging.
21+
22+
Here's a few things you should always do when making changes to the code base:
23+
24+
**Engineering guidelines**
25+
26+
Please follow the existing coding style used in this project.
27+
28+
**Commit/Pull Request Format**
29+
30+
```
31+
Summary of the changes (Less than 80 chars)
32+
- Detail 1
33+
- Detail 2
34+
35+
Addresses #bugnumber (in this specific format)
36+
```
37+
38+
**Tests**
39+
40+
- Tests need to be provided for every bug/feature that is completed.
41+
- If there is a scenario that is far too hard to test there does not need to be a test for it.
42+
- "Too hard" is determined by the team as a whole.

README.md

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,65 @@
11
# Winton.Extensions.Threading.Actor
2-
An implementation of an actor designed to integrate with C#'s async/await.
2+
3+
A lightweight implementation of the actor pattern designed to integrate with C#'s `async`/`await` keywords.
4+
It is a richer version of the implementation outlined on [Winton's Tech Blog](https://tech.winton.com/blog/2017/03/a-tpl-actor-pattern).
5+
6+
## Overview
7+
8+
Actors are objects that maintain a queue of work items and process that queue sequentially on a dedicated thread of
9+
execution.
10+
External agents pass work to an actor via messages.
11+
If required, messages can be used by an actor to transmit results in response to these messages.
12+
All interaction with actors is asynchronous.
13+
This is implemented here by viewing an inbound message as a delegate and an outbound response message as
14+
a `Task` or `Task<T>`.
15+
16+
An important motivation for using actors is to avoid the sharing of data between threads within a process and
17+
so avoid the pitfalls such as deadlocks of synchronising access to that data.
18+
Rather than share data, a single entity (the actor) which carries out all actions in series is
19+
given responsibility for maintaining that data.
20+
A program can then be built as a set of interacting actors.
21+
Here execution flow is well-defined in that the scope of a single thread of execution is bounded to
22+
a single actor instance rather than it being the case that a thread of execution can wander unbounded
23+
through application code.
24+
In effect a single thread has a particular responsibility and does not stray beyond that responsibility.
25+
26+
This library provides an implementation of an actor that allows work to be enqueued and handled sequentially.
27+
The actor can be started and stopped - though not paused - and support exists for specifying work to be done at both
28+
those state changes.
29+
In addition, a scheduler is provided to allow for the periodic scheduling of work on an actor.
30+
31+
## Documentation
32+
33+
The usage and API of this library are best illustrated via examples.
34+
These can be found in the [USAGE](USAGE.md) file.
35+
36+
## Supported platforms
37+
38+
The following platforms are supported:
39+
40+
- .NET Core
41+
- .NET 4.5.1
42+
43+
## Installation
44+
45+
The easiest way to install this library is to add a NuGet dependency on `Winton.Extensions.Threading.Actor` to your
46+
library.
47+
48+
## Building
49+
50+
Currently version `1.0` of the [.NET Core build tools](https://docs.microsoft.com/en-us/dotnet/articles/core/tools/) is required to build the source code.
51+
To build from Visual Studio you'll need VS 2017.
52+
53+
Assuming you have the .NET Core build tools installed, building the library from the command-line just involves:
54+
55+
```
56+
dotnet build
57+
```
58+
59+
The tests use [xUnit.net](https://xunit.github.io/).
60+
To run them from the command-line use:
61+
62+
```
63+
dotnet test Winton.Extensions.Threading.Actor.Tests.Unit/Winton.Extensions.Threading.Actor.Tests.Unit.csproj
64+
65+
```

0 commit comments

Comments
 (0)