Udostępnij za pośrednictwem


Timer.Purge Method

Definition

Removes all cancelled tasks from this timer's task queue.

[Android.Runtime.Register("purge", "()I", "GetPurgeHandler")]
public virtual int Purge ();
[<Android.Runtime.Register("purge", "()I", "GetPurgeHandler")>]
abstract member Purge : unit -> int
override this.Purge : unit -> int

Returns

the number of tasks removed from the queue.

Attributes

Remarks

Removes all cancelled tasks from this timer's task queue. Calling this method has no effect on the behavior of the timer, but eliminates the references to the cancelled tasks from the queue. If there are no external references to these tasks, they become eligible for garbage collection.

Most programs will have no need to call this method. It is designed for use by the rare application that cancels a large number of tasks. Calling this method trades time for space: the runtime of the method may be proportional to n + c log n, where n is the number of tasks in the queue and c is the number of cancelled tasks.

Note that it is permissible to call this method from within a task scheduled on this timer.

Added in 1.5.

Java documentation for java.util.Timer.purge().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to