From RAD Studio API Documentation
Jump to: navigation, search


function PopItem: T; overload;
function PopItem(var AQueueSize: Integer): T; overload;
function PopItem(var AQueueSize: Integer; var AItem: T): TWaitResult; overload;
function PopItem(var AItem: T): TWaitResult; overload;


T __fastcall PopItem()/* overload */;
T __fastcall PopItem(int &AQueueSize)/* overload */;
System::Types::TWaitResult __fastcall PopItem(int &AQueueSize, T &AItem)/* overload */;
System::Types::TWaitResult __fastcall PopItem(T &AItem)/* overload */;


Type Visibility Source Unit Parent
function public
System.Generics.Collections TThreadedQueue


Pops an item from the queue.

Use PushItem to pop an item from the queue according to the First In, First Out data management.

There are 4 overloaded PopItem methods:

  • Without parameters -- this method returns the popped item.
  • With a AQueueSize parameter -- this method also returns the popped item.
  • With two parameters: AQueueSize and AItem. AQueueSize specifies the position of the AItem item.
  • With an AItem parameter.

The last two methods return a TWaitResult. If the queue is empty, then the monitor waits for it to push an element. If no element is pushed in PopTimeout, the method returns wrTimeout; otherwise, the method returns wrSignaled.

Use the last two methods when you need to know whether the pop was successfully completed.

See Also