Share via


AsyncQueue<T>.Completion Property

Definition

Gets a task that transitions to a completed state when Complete() is called and the queue is empty.

public:
 property System::Threading::Tasks::Task ^ Completion { System::Threading::Tasks::Task ^ get(); };
public System.Threading.Tasks.Task Completion { get; }
member this.Completion : System.Threading.Tasks.Task
Public ReadOnly Property Completion As Task

Property Value

Returns Task.

Remarks

This property is volatile in order to prevent the CPU from reordering commands around the assignment (or read) of this field. This allows the check-lock-check pattern in this property to be reliable when one thread within the lock initializes the value and assigns the field, and the weak memory model allows it to be assigned before it is initialized. Another thread outside the lock might observe the non-null field and start accessing the Task property before it is actually initialized.

Applies to