#if NET40 || !NET_4_6
using System.Runtime.CompilerServices;
namespace System.Threading.Tasks
{
///
/// Provides extension methods for threading-related types.
///
///
///
/// Asynchronous wrappers for .NET Framework operations.
///
///
///
/// Provides extension methods for threading-related types.
///
///
///
/// AsyncCtpThreadingExtensions is a placeholder.
///
public static class AsyncCompatLibExtensions
{
///
/// Creates and configures an awaitable object for awaiting the specified task.
///
/// The task to be awaited.
/// true to automatic marshal back to the original call site's current SynchronizationContext
/// or TaskScheduler; otherwise, false.
///
/// The instance to be awaited.
///
public static ConfiguredTaskAwaitable ConfigureAwait(this Task task,
bool continueOnCapturedContext)
{
if (task == null)
throw new ArgumentNullException("task");
return new ConfiguredTaskAwaitable(task, continueOnCapturedContext);
}
///
/// Creates and configures an awaitable object for awaiting the specified task.
///
/// The task to be awaited.
/// true to automatic marshal back to the original call site's current SynchronizationContext
/// or TaskScheduler; otherwise, false.
///
/// The instance to be awaited.
///
public static ConfiguredTaskAwaitable ConfigureAwait(this Task task, bool continueOnCapturedContext)
{
if (task == null)
throw new ArgumentNullException("task");
return new ConfiguredTaskAwaitable(task, continueOnCapturedContext);
}
///
/// Gets an awaiter used to await this .
///
/// The task to await.
///
/// An awaiter instance.
///
public static TaskAwaiter GetAwaiter(this Task task)
{
if (task == null)
throw new ArgumentNullException("task");
return new TaskAwaiter(task);
}
///
/// Gets an awaiter used to await this .
///
/// Specifies the type of data returned by the task.
/// The task to await.
///
/// An awaiter instance.
///
public static TaskAwaiter GetAwaiter(this Task task)
{
if (task == null)
throw new ArgumentNullException("task");
return new TaskAwaiter(task);
}
}
}
#endif