# ctaGetQueueHandle

Obtains the queue handle of the specified context.

#### Prototype

DWORD ctaGetQueueHandle ( CTAHD ctahd, CTAQUEUEHD *ctaqueuehd)

Argument | Description
ctahd | Context handle.
ctaqueuehd | Pointer to a returned queue handle associated with the context handle.

#### Return values

Return value | Description
SUCCESS |
CTAERR_BAD_ARGUMENT | ctaqueuehd is NULL.
CTAERR_INVALID_CTAHD | An invalid context handle was passed as an argument to a function, or the context was destroyed by another thread.
CTAERR_NOT_INITIALIZED | Natural Access is not initialized. Call ctaInitialize first.

#### Details

ctaGetQueueHandle obtains the queue handle associated with the context.

Because there is overhead involved in calling ctaGetQueueHandle, use it mainly with the single context per queue model. Applications should save both the context and the queue handles to avoid calling this function on every call to ctaWaitEvent.

#### See also

ctaCreateContext

#### Example

DWORD NMSSTDCALL DemoErrorHandler( CTAHD ctahd, DWORD errorcode,
char *errortext, char *func )
{
if (ctahd == NULL_CTAHD)
{
printf( "\007Error in %s [ctahd=null]: %s (%#x)\n",
func, errortext, errorcode );
}
else
{
CTAQUEUEHD ctaqueuehd;
ctaGetQueueHandle(ctahd, &ctaqueuehd);
printf( "\007Error in %s [ctahd=%#x, ctaqueuehd=%#x]: %s (%#x)\n",
func, ctahd, ctaqueuehd, errortext, errorcode );
}
exit( errorcode );
}