Skip to content
Browse files

some API fix.

  • Loading branch information...
1 parent 81926b9 commit aa1ef9a35ae11675a6f3915cdf3f5ad15295686f @atsushieno committed
View
2 System.Reactive.Core/System.Reactive.Concurrency/DefaultScheduler.cs
@@ -30,7 +30,7 @@ public IDisposable SchedulePeriodic<TState> (TState state, TimeSpan period, Func
throw new NotImplementedException ();
}
- public object GetService (Type serviceType)
+ protected override object GetService (Type serviceType)
{
throw new NotImplementedException ();
}
View
2 System.Reactive.Core/System.Reactive.Concurrency/LocalScheduler.cs
@@ -67,7 +67,7 @@ object IServiceProvider.GetService (Type serviceType)
return GetService (serviceType);
}
- protected object GetService (Type serviceType)
+ protected virtual object GetService (Type serviceType)
{
if (serviceType == typeof (INotifySystemClockChanged))
return timer_clock_monitor;
View
19 System.Reactive/System.Reactive.Concurrency/HistoricalScheduler.cs
@@ -40,9 +40,26 @@ public override IDisposable ScheduleAbsolute<TState> (TState state, DateTimeOffs
ScheduledItemImpl<DateTimeOffset> t = null;
t = new ScheduledItemImpl<DateTimeOffset> (dueTime, () => { tasks.Remove (t); return action (this, state); });
- Scheduler.InternalAddTask (tasks, t);
+ InternalAddTask (tasks, t);
return new CompositeDisposable (Disposable.Create (() => tasks.Remove (t)), t);
}
+
+ internal static void InternalAddTask (IList<ScheduledItem<DateTimeOffset>> tasks, ScheduledItem<DateTimeOffset> task)
+ {
+ // It is most likely appended in order, so don't use ineffective List.Sort(). Simple comparison makes it faster.
+ // Also, it is important that events are processed *in order* when they are scheduled at the same moment.
+ int pos = -1;
+ DateTimeOffset dueTime = task.DueTime;
+ for (int i = tasks.Count - 1; i >= 0; i--) {
+ if (dueTime >= tasks [i].DueTime) {
+ tasks.Insert (i + 1, task);
+ pos = i;
+ break;
+ }
+ }
+ if (pos < 0)
+ tasks.Insert (0, task);
+ }
}
}
View
28 System.Reactive/System.Reactive.Concurrency/Scheduler.cs
@@ -23,9 +23,8 @@ public static class Scheduler
}
#if REACTIVE_2_0
- // FIXME: find out correct return type and instance
- public static IScheduler Default {
- get { return NewThread; }
+ public static DefaultScheduler Default {
+ get { return DefaultScheduler.Instance; }
}
// Those properties are [Obsolete] only in non-portable build...
@@ -141,29 +140,6 @@ public static IDisposable Schedule<TState> (this IScheduler scheduler, TState st
}
#if REACTIVE_2_0
- // FIXME: shouldn't be public.
- public
-#else
- internal
-#endif
- static void InternalAddTask (IList<ScheduledItem<DateTimeOffset>> tasks, ScheduledItem<DateTimeOffset> task)
- {
- // It is most likely appended in order, so don't use ineffective List.Sort(). Simple comparison makes it faster.
- // Also, it is important that events are processed *in order* when they are scheduled at the same moment.
- int pos = -1;
- DateTimeOffset dueTime = task.DueTime;
- for (int i = tasks.Count - 1; i >= 0; i--) {
- if (dueTime >= tasks [i].DueTime) {
- tasks.Insert (i + 1, task);
- pos = i;
- break;
- }
- }
- if (pos < 0)
- tasks.Insert (0, task);
- }
-
-#if REACTIVE_2_0
public static ISchedulerLongRunning AsLongRunning (this IScheduler scheduler)
{
// is this method really just like this...?

0 comments on commit aa1ef9a

Please sign in to comment.
Something went wrong with that request. Please try again.