You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .appveyor.yml
+6-13Lines changed: 6 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -6,15 +6,11 @@ environment:
6
6
# Don't report back to the mothership
7
7
DOTNET_CLI_TELEMETRY_OPTOUT: 1
8
8
9
-
install:
10
-
- ps: scripts\Get-Deps.ps1
11
-
12
9
before_build:
13
-
- dotnet --info
14
10
- appveyor-retry dotnet restore -v Minimal
15
11
16
12
build_script:
17
-
- dotnet build --no-restore -c %CONFIGURATION%
13
+
- .\build -c %CONFIGURATION%
18
14
19
15
test:
20
16
assemblies:
@@ -25,13 +21,10 @@ test:
25
21
- DoNotRunOnAppVeyor
26
22
27
23
after_test:
28
-
- : |
29
-
dotnet pack --no-restore -c %CONFIGURATION%
30
-
set OUTDIR=build\npm
31
-
set SRCDIR=build\packages
32
-
mkdir %OUTDIR% >nul 2>nul || ver>nul
33
-
for /f "delims=" %%d in ('dir /b /a:d %SRCDIR%') do (pushd %SRCDIR%\%%d && for /f "delims=" %%f in ('call npm pack --quiet') do move %%f ..\..\npm\%%f && popd)
Unity.Editor.Tasks is a TPL-based (Task Parallel Library, or System.Threading.Tasks) task management library.
5
+
Unity.Editor.Tasks is a TPL-based task management library.
4
6
5
-
This repository is a subset of the functionality in [Git for Unity](https://github.com/Unity-Technologies/Git-for-Unity) repository, specifically the `Threading`, `OutputProcessors`, `Tasks`, `Process` and `IO` directories, as well as various helper classes found in [](https://github.com/Unity-Technologies/Git-for-Unity/tree/master/src/com.unity.git.api/Api).
7
+
This repository is a subset of the functionality in the [Git for Unity](https://github.com/Unity-Technologies/Git-for-Unity) repository, specifically the `Threading`, `OutputProcessors`, `Tasks`, `Process` and `IO` directories, as well as various helper classes found in the [Api](https://github.com/Unity-Technologies/Git-for-Unity/tree/master/src/com.unity.git.api/Api) source directory.
6
8
7
9
It's been split up for easier testing and consumption by the Git package and any other packages, libraries or apps that wish to use it.
8
10
11
+
It is essentially a wrapper of `System.Threading.Tasks.Task` objects, with custom schedulers providing easy execution of tasks in a variety of scenarios:
12
+
13
+
- UI: tasks can be scheduled to the UI thread, which uses `EditorApplication.delayCall`
14
+
15
+
- Exclusive/Concurrent: A pair of synchronized schedulers allow for a one writer/many readers scenario, where any task with an Exclusive affinity is guaranteed to run on its own without any other Exclusive or Concurrent affinity tasks executing at the same time. Concurrent affinity tasks can run with other tasks any affinity except Exclusive.
16
+
17
+
This allows tasks to safely execute code that requires locking resources without worrying about other threads touching the same resources.
18
+
19
+
- None: tasks run on the default scheduler (threadpool) without constraints.
20
+
- LongRunning: tasks run on the default scheduler (threadpool), but the task management system doesn't expect them to finish in a short time and doesn't impose task timeouts (if the task supports such a thing);
21
+
22
+
It provides easy chaining of tasks with a rx.net-like API that allows data flow from one task to the other, progress reporting, catch and finally handlers, support for wrapping async/await methods and for ensuring they run outside of play mode, and ready-made tasks for running processes and processing/streaming their output.
23
+
24
+
Standard .NET async methods can be integrated into this library and executed with specific affinities using the `TPLTask` class. Similarly, going from an Editor Task to the async/await model is just a matter of awaiting the underlying `Task` property.
25
+
26
+
27
+
## Usage examples
28
+
29
+
There are a number of tests in `src/com.unity.editor.tasks/Tests/Editor` that can provide useful guidance.
30
+
31
+
### Downloading a bunch of things in the background
32
+
33
+
```
34
+
// you'll want to keep one instance of this around.
35
+
// Initialization must happen on the UI thread so it knows how to schedule things to it
36
+
var taskManager = new TaskManager.Initialize();
37
+
38
+
// the Downloader is a TaskQueue-type task which handles firing up a series of concurrent tasks,
39
+
// aggregating all of the data from each of the tasks and returning it all together
0 commit comments