// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
using System.ComponentModel;
using System.Reactive.PlatformServices;
namespace System.Reactive.Concurrency
{
///
/// (Infrastructure) Concurrency abstraction layer.
///
internal static class ConcurrencyAbstractionLayer
{
///
/// Gets the current CAL. If no CAL has been set yet, it will be initialized to the default.
///
public static IConcurrencyAbstractionLayer Current { get; } = Initialize();
private static IConcurrencyAbstractionLayer Initialize()
{
return PlatformEnlightenmentProvider.Current.GetService() ?? new DefaultConcurrencyAbstractionLayer();
}
}
///
/// (Infrastructure) Concurrency abstraction layer interface.
///
///
/// This type is used by the Rx infrastructure and not meant for public consumption or implementation.
/// No guarantees are made about forward compatibility of the type's functionality and its usage.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public interface IConcurrencyAbstractionLayer
{
///
/// Queues a method for execution at the specified relative time.
///
/// Method to execute.
/// State to pass to the method.
/// Time to execute the method on.
/// Disposable object that can be used to stop the timer.
IDisposable StartTimer(Action