> ## 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](/zh-TW/reference/system/xgamestreaming/functions/xgamestreamingconnectionstatechangedcallback)。

## 語法

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

### 參數

*token*   \_In\_
類型：XTaskQueueRegistrationToken

對應至透過 [XGameStreamingRegisterConnectionStateChanged](/zh-TW/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](/zh-TW/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](/zh-TW/reference/system/xgamestreaming/functions/xgamestreamingconnectionstatechangedcallback)\
[XGameStreamingRegisterConnectionStateChanged](/zh-TW/reference/system/xgamestreaming/functions/xgamestreamingregisterconnectionstatechanged)\
[XGameStreaming](/zh-TW/reference/system/xgamestreaming/xgamestreaming_members)


## Related topics

- [XGameStreamingUnregisterConnectionStateChanged](/reference/system/xgamestreaming/functions/xgamestreamingunregisterconnectionstatechanged.md)
- [XGameStreamingRegisterConnectionStateChanged](/reference/system/xgamestreaming/functions/xgamestreamingregisterconnectionstatechanged.md)
- [XGameStreamingConnectionStateChangedCallback](/reference/system/xgamestreaming/functions/xgamestreamingconnectionstatechangedcallback.md)
