Files
Umbraco-CMS/src/Umbraco.Web/Scheduling/IBackgroundTask.cs

30 lines
924 B
C#
Raw Normal View History

using System;
2015-02-17 15:09:29 +01:00
using System.Threading;
using System.Threading.Tasks;
namespace Umbraco.Web.Scheduling
{
2015-02-06 16:10:34 +01:00
/// <summary>
/// Represents a background task.
/// </summary>
internal interface IBackgroundTask : IDisposable
{
2015-02-06 16:10:34 +01:00
/// <summary>
/// Runs the background task.
/// </summary>
void Run();
2015-02-06 16:10:34 +01:00
/// <summary>
/// Runs the task asynchronously.
/// </summary>
2015-02-17 15:09:29 +01:00
/// <param name="token">A cancellation token.</param>
2015-02-06 16:10:34 +01:00
/// <returns>A <see cref="Task"/> instance representing the execution of the background task.</returns>
/// <exception cref="NotImplementedException">The background task cannot run asynchronously.</exception>
2015-02-17 15:09:29 +01:00
Task RunAsync(CancellationToken token);
2015-02-06 16:10:34 +01:00
/// <summary>
/// Indicates whether the background task can run asynchronously.
/// </summary>
bool IsAsync { get; }
}
}