public Continuation(T inst, FrameScheduler scheduler) { instruction = inst; continuation = null; owner = null; Scheduler = scheduler; }
public Continuation(T inst, IManageableObject owner, FrameScheduler scheduler) { instruction = inst; continuation = null; this.owner = owner; Scheduler = scheduler; }
public Continuation(T inst) { instruction = inst; continuation = null; owner = null; Scheduler = FrameScheduler.BeforeUpdate; }
/// <summary> /// Performs all scheduled disposal calls and cleans up internal data. This is done automatically at the /// end of each <see cref="Update">frame update</see> and you shouldn't need to call this in general. /// Invoking this method while an update is still in progress may result in undefined behavior. Don't do this. /// </summary> public static void RunCleanup() { // Perform scheduled object disposals object[] disposeScheduleArray; bool lockTaken = false; try { disposeScheduleLock.Enter(ref lockTaken); disposeScheduleArray = disposeSchedule.ToArray(); disposeSchedule.Clear(); } finally { if (lockTaken) { disposeScheduleLock.Exit(); } } foreach (object o in disposeScheduleArray) { IManageableObject m = o as IManageableObject; if (m != null) { m.Dispose(); continue; } IDisposable d = o as IDisposable; if (d != null) { d.Dispose(); continue; } } // Perform late finalization and remove disposed object references Resource.RunCleanup(); Scene.Current.RunCleanup(); }
public Continuation(T inst, CancellationToken cancellationToken, FrameScheduler scheduler) { instruction = inst; continuation = null; owner = null; this.cancellationToken = cancellationToken; Scheduler = scheduler; }
private static void RunCleanup() { foreach (object o in disposeSchedule) { IManageableObject m = o as IManageableObject; if (m != null) { m.Dispose(); continue; } IDisposable d = o as IDisposable; if (d != null) { d.Dispose(); continue; } } disposeSchedule.Clear(); Resource.RunCleanup(); Scene.Current.RunCleanup(); }
/// <summary> /// Performs all scheduled disposal calls and cleans up internal data. This is done automatically at the /// end of each <see cref="Update()">frame update</see> and you shouldn't need to call this in general. /// Invoking this method while an update is still in progress may result in undefined behavior. Don't do this. /// </summary> public static void RunCleanup() { // Perform scheduled object disposals object[] disposeScheduleArray = disposeSchedule.ToArray(); disposeSchedule.Clear(); foreach (object o in disposeScheduleArray) { IManageableObject m = o as IManageableObject; if (m != null) { m.Dispose(); continue; } IDisposable d = o as IDisposable; if (d != null) { d.Dispose(); continue; } } // Perform late finalization and remove disposed object references Resource.RunCleanup(); }
protected void LocalClearDisposed() { this.LocalClear(o => { if (o == null) { return(true); } IManageableObject manObj = o as IManageableObject; if (manObj != null && manObj.Disposed) { return(true); } Resource resObj = o as Resource; if (resObj != null && resObj.Disposed) { return(true); } return(false); }); }
/// <summary> /// Link the <see cref="Duality.Async.IAwaitInstruction"/>'s lifespan to an object. /// </summary> /// <returns>A continuation with updated params.</returns> public static Continuation <T> ConfigureAwait <T>(this T @this, IManageableObject owner) where T : IAwaitInstruction => new Continuation <T>(@this).ConfigureAwait(owner);
public Continuation <T> ConfigureAwait(IManageableObject owner, FrameScheduler scheduler) { this.owner = owner; Scheduler = scheduler; return(this); }
public Continuation <T> ConfigureAwait(IManageableObject owner) { this.owner = owner; return(this); }
/// <summary> /// Schedules this object for disposal at the end of the current update cycle. /// </summary> /// <param name="obj"></param> public static void DisposeLater(this IManageableObject obj) { DualityApp.DisposeLater(obj); }