Packet Sniffer SDK DLL Edition

HNQueue :: Methods :: QueStart

 Previous Next

Creates and starts internal queue thread.

Syntax:

DWORD __stdcall QueStart(HANDLE hQue);

Parameters:

hQue

[in] HNQueue object handle.

Return values:

HNERR_OKNo errors.
HNERR_CREATE_SYNCOBJ_ERRQueue synchronization object creation error (see QueAllocItems).
HNERR_THREAD_ERRThread creating error.

Description:

Use QueStart to start internal queue thread. If this function succeeds, then HNQueue object creates internal thread for Full queue items processing.

Also after QueStart call OnThreadBegin event handler will be called in this thread context, and then this thread switches itself in awaiting status by QueGetFullItem function call.

If the queue at this moment contains at least one element with Full status, then this thread will switch off itself from awaiting status immediately and call OnPacketReceive event handler.

Please remember that OnPacketReceive event handler starts after Get_FillItem function call, so after the work with an element of the queue is completed, you have to return it back to the queue by QueReturnFreeItem function.

Another warning:

Call QueStart function only in case of using the queue in "automatic mode", i.e. if you get packets from the queue by OnPacketReceive event handler. Never call QueStart function, if you're working in the "manual mode", i.e. if you get packets by QueGetFullItem function.
See also:HNQueue, QueAllocItems, QueGetFullItem, OnThreadBegin, OnPacketReceive, QueReturnFreeItem