> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# XPackageUnregisterPackageInstalled

> XPackageUnregisterPackageInstalled

# XPackageUnregisterPackageInstalled

Unregisters a previously registered package installed callback.

## Syntax

```cpp theme={null}
bool XPackageUnregisterPackageInstalled(  
         XTaskQueueRegistrationToken token,  
         bool wait  
)  
```

### Parameters

*token*   \_In\_\
Type: [XTaskQueueRegistrationToken](/reference/system/xtaskqueue/structs/xtaskqueueregistrationtoken)

The token returned by [XPackageRegisterPackageInstalled](/reference/system/xpackage/functions/xpackageregisterpackageinstalled).

*wait*   \_In\_\
Type: bool

Indicates whether to block until any pending callbacks are completed.

### Return value

Type: bool

If *wait* is false and unregistration is pending, returns false. Otherwise, returns true.

## Remarks

<Note>This function isn't safe to call on a time-sensitive thread. For more information, see [Time-sensitive threads](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads).</Note>

Unregistration of a notification behaves as follows:

* From the set of registered callbacks, unregistration removes the callback associated with the token.
* If no callbacks are executing for that callback token, the call returns true.
* If callbacks are executing and *wait* is true, the call will block until the executing callback has finished.
* If callbacks are executing and *wait* is false, the call will not block but will return false. After the callback for the token is completed, the token is unregistered automatically.

This mechanism allows for the following coding patterns:

1. You can block on unregistration to ensure your callbacks are never invoked after a call to unregister.
2. You can choose not to block. To ensure that your callbacks are completed before deleting data, periodically call unregister with false for *wait*. When it finally returns true, all your callbacks are done and you can delete the state.
3. If your callback doesn't care whether it's being invoked during an unregister call, you can just pass false for *wait* and ignore the return value.

The following code sample illustrates the use of **XPackageUnregisterPackageInstalled**:

```cpp theme={null}
void StopListeningForDlc(XTaskQueueRegistrationToken token)
{
    XPackageUnregisterPackageInstalled(token, false);
}  
```

## Requirements

**Header:** XPackage.h

**Library:** xgameruntime.lib

**Supported platforms:** Windows, XBOX One family consoles and XBOX Series consoles

## Conceptual documentation

* [Time-sensitive threads](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads)

## See also

[XPackage](/reference/system/xpackage/xpackage_members)\
[How to create and use Downloadable Content Packages (DLC) for PC and XBOX One](/build/core-features/common/packaging/packaging-downloadable-content-dlc)


## Related topics

- [XPackageRegisterPackageInstalled](/reference/system/xpackage/functions/xpackageregisterpackageinstalled.md)
- [XPackage](/reference/system/xpackage/xpackage_members.md)
- [XTaskQueueRegistrationToken](/reference/system/xtaskqueue/structs/xtaskqueueregistrationtoken.md)
- [XPackageInstalledCallback](/reference/system/xpackage/functions/xpackageinstalledcallback.md)
- [XtfUnregisterPackage](/reference/tools/xtf/xtfapi/functions/xtfunregisterpackage-xtfapi-xbox-windows-m.md)
