> ## 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.

# XGameStreamingUnregisterConnectionStateChanged

> XGameStreamingUnregisterConnectionStateChanged

# XGameStreamingUnregisterConnectionStateChanged

取消注册先前注册的 [XGameStreamingConnectionStateChangedCallback](/reference/system/xgamestreaming/functions/xgamestreamingconnectionstatechangedcallback)。

## 语法

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

### 参数

*token*   \_In\_
类型：XTaskQueueRegistrationToken

对应于通过 [XGameStreamingRegisterConnectionStateChanged](/reference/system/xgamestreaming/functions/xgamestreamingregisterconnectionstatechanged) 完成的回调注册的令牌。

*wait*   \
类型：bool

如果 `wait` 设置为 true，则 `XGameStreamingUnregisterConnectionStateChanged` 在注册被撤销并且任何未完成的回调完成之前不会返回。

如果 `wait` 设置为 false，则 `XGameStreamingUnregisterConnectionStateChanged` 将在注册被撤销后立即返回。虽然不会传递新的回调，但当函数返回时正在进行中的回调可能仍在执行。

### 返回值

类型：bool

如果取消注册成功则返回 true，如果未成功则返回 false。

## 备注

<Note>此函数在时间敏感线程上调用不安全。有关详细信息，请参阅[时间敏感线程](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads)。</Note>

此 API 可用于停止侦听流式处理客户端设备的连接更改。

当游戏将只利用 [XGameStreamingIsStreaming](/reference/system/xgamestreaming/functions/xgamestreamingisstreaming) 广泛检查是否有任何客户端正在流式处理，或者不再针对流式处理客户端优化体验时，应执行此操作。

## 要求

**标头：** xgamestreaming.h

**库：** xgameruntime.lib

**支持的平台：** Windows、XBOX One 系列主机和 XBOX Series 主机

## 概念文档

* [时间敏感线程](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads)

## 另请参阅

[XGameStreamingConnectionStateChangedCallback](/reference/system/xgamestreaming/functions/xgamestreamingconnectionstatechangedcallback)\
[XGameStreamingRegisterConnectionStateChanged](/reference/system/xgamestreaming/functions/xgamestreamingregisterconnectionstatechanged)\
[XGameStreaming](/reference/system/xgamestreaming/xgamestreaming_members)


## Related topics

- [XGameStreamingConnectionStateChangedCallback](/zh-CN/reference/system/xgamestreaming/functions/xgamestreamingconnectionstatechangedcallback.md)
- [XGameStreamingRegisterConnectionStateChanged](/zh-CN/reference/system/xgamestreaming/functions/xgamestreamingregisterconnectionstatechanged.md)
- [XGameStreamingConnectionState](/zh-CN/reference/system/xgamestreaming/enums/xgamestreamingconnectionstate.md)
- [XGameStreamingIsStreaming](/zh-CN/reference/system/xgamestreaming/functions/xgamestreamingisstreaming.md)
- [XGameStreaming](/zh-CN/reference/system/xgamestreaming/xgamestreaming_members.md)
