This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Worker | |
{ | |
public Task DoWorkAsync() => ThrowOnBlockingTaskWaitPolicy.Execute(async () => | |
{ | |
await Task.Yield(); | |
Console.WriteLine("doing some work"); | |
await Task.Delay(1000); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// A thread-safe disposable to act as a placeholder for a disposable that is not yet available. | |
/// </summary> | |
public sealed class FutureDisposable : IDisposable | |
{ | |
private const int No = 0; | |
private const int Yes = 1; | |
private static readonly IDisposable AlreadyDisposed = new NoopDisposable(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ node -v | |
v7.2.1 | |
$ webpack -v | |
2.2.1 | |
$ webpack | |
Hash: a4b355f414e9de6fe312 | |
Version: webpack 2.2.1 | |
Time: 4316ms | |
Asset Size Chunks Chunk Names | |
app.bundle.js 2.7 kB 1 [emitted] app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Waits for the task to complete, unwrapping any exceptions. | |
/// </summary> | |
/// <param name="task">The task. May not be <c>null</c>.</param> | |
public static void WaitAndUnwrapException(this Task task) | |
{ | |
task.GetAwaiter().GetResult(); | |
} |