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

# IDStorageFactoryX::SetCpuAffinity

> IDStorageFactoryX::SetCpuAffinity

# IDStorageFactoryX::SetCpuAffinity

为 DirectStorage 设置 CPU 亲和性掩码。

## Syntax

```cpp theme={null}
HRESULT SetCpuAffinity(  
         UINT64 affinity  
)  
```

### Parameters

*affinity*\
类型：UINT64

CPU 亲和性掩码。

### Return value

类型：HRESULT

标准 HRESULT 错误代码。

## Remarks

DirectStorage 通常在调用方线程中执行工作。但是，某些工作无法在调用方线程中执行。若要将此类工作限制在指定的一组 CPU 内核上运行，请设置 CPU 亲和性掩码。

有关详细信息，请参阅 [DirectStorage 概述](/build/console-features/storage/directstorage/directstorage-overview) 中“IDStorageFileX”一节内的“SetCPUAffinity”。

## Requirements

**头文件：** dstorage\_xs.h

**库：** dstorage\_xs.lib

**受支持的平台：** XBOX Series 主机

## See also

[IDStorageFactoryX](/reference/system/dstorage/interfaces/IDStorageFactoryX/idstoragefactoryx)\
[DStorage](/reference/system/dstorage/dstorage_members)


## Related topics

- [IDStorageFactoryX::SetDebugFlags](/zh-CN/reference/system/dstorage/interfaces/IDStorageFactoryX/methods/idstoragefactoryx_setdebugflags.md)
- [IDStorageFactoryX::SetStagingBufferSize](/zh-CN/reference/system/dstorage/interfaces/IDStorageFactoryX/methods/idstoragefactoryx_setstagingbuffersize.md)
- [IDStorageFactoryX](/zh-CN/reference/system/dstorage/interfaces/IDStorageFactoryX/idstoragefactoryx.md)
- [DirectStorage 概述](/zh-CN/build/console-features/storage/directstorage/directstorage-overview.md)
- [IDStorageFactoryX::OpenFile](/zh-CN/reference/system/dstorage/interfaces/IDStorageFactoryX/methods/idstoragefactoryx_openfile.md)
