2014-12-07 16:16:29 +01:00
|
|
|
|
using System;
|
2015-02-17 15:09:29 +01:00
|
|
|
|
using System.Threading;
|
2015-01-29 12:45:44 +11:00
|
|
|
|
using System.Threading.Tasks;
|
2014-12-07 16:16:29 +01:00
|
|
|
|
|
|
|
|
|
|
namespace Umbraco.Web.Scheduling
|
|
|
|
|
|
{
|
2015-02-06 16:10:34 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Represents a background task.
|
|
|
|
|
|
/// </summary>
|
2016-08-24 10:11:38 +02:00
|
|
|
|
public interface IBackgroundTask : IDisposable
|
2014-12-07 16:16:29 +01:00
|
|
|
|
{
|
2015-02-06 16:10:34 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Runs the background task.
|
|
|
|
|
|
/// </summary>
|
2014-12-07 16:16:29 +01:00
|
|
|
|
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>
|
2015-01-29 12:45:44 +11:00
|
|
|
|
bool IsAsync { get; }
|
2014-12-07 16:16:29 +01:00
|
|
|
|
}
|
2017-07-20 11:21:28 +02:00
|
|
|
|
}
|