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

# XPackageUpdateInstallationMonitor

> XPackageUpdateInstallationMonitor

# XPackageUpdateInstallationMonitor

刷新从 [XPackageGetInstallationProgress](/reference/system/xpackage/functions/xpackagegetinstallationprogress) 返回的进度。

## 语法

```cpp theme={null}
bool XPackageUpdateInstallationMonitor(  
         XPackageInstallationMonitorHandle installationMonitor  
)  
```

### 参数

*installationMonitor*   \_In\_\
类型：XPackageInstallationMonitorHandle

要更新的安装监视器的句柄。

### 返回值

类型：bool

如果进度快照的任何方面发生了变化，则返回 true。否则，返回 false。

## 备注

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

可以调用 **XPackageUpdateInstallationMonitor** 来刷新从 [XPackageGetInstallationProgress](/reference/system/xpackage/functions/xpackagegetinstallationprogress) 返回的进度。如果安装监视器的刷新节奏不为零，则此 API 将从计时器线程按刷新节奏自动调用。若要控制哪个线程更新进度，请将节奏设为零，然后自行调用此 API。如果进度快照的任何方面发生了变化，**XPackageUpdateInstallationMonitor** 将返回 true。

下面是一个使用 **XPackageUpdateInstallationMonitor** 手动轮询安装监视器以确定游戏安装是否完成的示例。安装完成后，此代码会关闭监视器句柄。

```cpp theme={null}
bool CheckIfInstalled(XPackageInstallationMonitorHandle monitor)
{
    XPackageInstallationProgress progress;
    XPackageGetInstallationProgress(monitor, &progress);

    if (!progress.completed && XPackageUpdateInstallationMonitor(monitor))
    {
        XPackageGetInstallationProgress(monitor, &progress);
    }

    if (progress.completed)
    {
        XPackageCloseInstallationMonitorHandle(monitor);
    }

    return progress.completed;
}
```

## 要求

**头文件：** XPackage.h

**库：** xgameruntime.lib

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

## 概念文档

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

## 另请参阅

[XPackage](/reference/system/xpackage/xpackage_members)\
[流式安装和智能交付](/build/core-features/common/packaging/overviews/streaming_install-intelligent_delivery)\
[XPackageGetInstallationProgress](/reference/system/xpackage/functions/xpackagegetinstallationprogress)


## Related topics

- [XPackage](/zh-CN/reference/system/xpackage/xpackage_members.md)
- [面向 GDK 的 Unity C# API 包装器](/zh-CN/build/gdk-and-engines/unity/unity-api-wrappers.md)
- [XPackageCreateInstallationMonitor](/zh-CN/reference/system/xpackage/functions/xpackagecreateinstallationmonitor.md)
- [XPackageCloseInstallationMonitorHandle](/zh-CN/reference/system/xpackage/functions/xpackagecloseinstallationmonitorhandle.md)
- [XPackageGetInstallationProgress](/zh-CN/reference/system/xpackage/functions/xpackagegetinstallationprogress.md)
