Packet Sniffer SDK DLL Edition

HNQueue :: Methods :: QueGetFreeItem

 Previous Next

Returns HNPacket object with Free status from the queue.

Syntax:

HANDLE __stdcall QueGetFreeItem(HANDLE hQue, DWORD Milliseconds);

Parameters:

hQue

[in] HNQueue object handle.

Milliseconds

[in] Specifies the time-out interval, in milliseconds. The function returns if the interval elapses, even if the object's state is nonsignaled (i.e., there are no any free objects in the queue). If Milliseconds is zero, the function tests the object's state and returns immediately. If Milliseconds is INFINITE(0xFFFFFFFF), the function's time-out interval never elapses.

Return values:

If this function succeeds, then an HNPacket object with Free status will be returned. If returned value is equal to NULL, then there are no free elements, or the status of the thread awaiting for packet enqueueing was changed by the QueUnblockWaitFree function.

Description:

Use QueGetFreeItem to get free element from the queue. After this function is executed FreeCount [Get] property is changed.

Also, please take in account, that after an element of the queue is processed, you should return it to the queue using QueReturnFullItem or QueReturnFreeItem functions.

Use QueReturnFullItem function to return HNPacket to the queue, if it must be considered as Full, and must be accessible by the QueGetFullItem function call later.

Use QueReturnFreeItem function to return HNPacket to the queue, if it must be considered as Free, and must be accessible by the QueGetFreeItem function call later.

Please, never call the QueReturnFullItem and QueReturnFreeItem functions for HNPacket objects not belonging to the queue, i.e. objects, which aren't obtained from the queue by QueGetFreeItem and QueGetFullItem functions, or in the OnPacketReceive event handler.
See also:HNQueue, HNPacket, QueUnblockWaitFree, QueGetFreeCount, QueReturnFullItem, QueReturnFreeItem