# ctaUnregisterWaitObject

Unregisters a previously registered wait object. Use this function when Natural Access is managing wait objects.

#### Prototype

DWORD ctaUnregisterWaitObject ( CTAQUEUEHD ctaqueuehd, CTA_WAITOBJ *waitobj)

Argument | Description
ctaqueuehd | Context handle.
waitobj | Pointer to the handle of the application wait object.

#### Return values

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

#### Details

ctaUnregisterWaitObject unregisters a wait object from Natural Access. The wait object was registered by a previous call to ctaRegisterWaitObject. On return from this function, Natural Access ignores any signals on the wait object.

Note: Do not use ctaUnregisterWaitObject if the application is managing and waiting on wait objects outside of ctaWaitEvent (in ctaInitialize, ctaflags field in initparms is set to CTA_NOTIFY_UPDATE_WAITOBJS).

Refer to Using wait objects for more information.

#### Example

#include "nmstypes.h"
#include "ctademo.h"
#include "ctadef.h"
void unregister_waitobj(CTAQUEUEHD ctaqueuehd, CTA_WAITOBJ *waitobj)
{
DWORD ret;
ret = ctaUnregisterWaitObject(ctaqueuehd, waitobj);
if (ret != SUCCESS)
printf("UnregisterWaitObject failed...\n");
}