> ## 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 親和性遮罩。

## 語法

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

### 參數

*affinity*\
類型：UINT64

CPU 親和性遮罩。

### 傳回值

類型：HRESULT

標準 HRESULT 錯誤碼。

## 備註

DirectStorage 通常會在呼叫執行緒中執行工作。不過，有些工作無法在呼叫執行緒中執行。若要將這類工作限制在指定的一組 CPU 核心上，請設定 CPU 親和性遮罩。

如需詳細資訊，請參閱 [DirectStorage 概觀](/zh-TW/build/console-features/storage/directstorage/directstorage-overview)中「IDStorageFileX」一節的「SetCPUAffinity」。

## 需求

**標頭：** dstorage\_xs.h

**程式庫：** dstorage\_xs.lib

**支援的平台：** XBOX Series 主機

## 另請參閱

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


## Related topics

- [IDStorageFactoryX::SetCpuAffinity](/reference/system/dstorage/interfaces/IDStorageFactoryX/methods/idstoragefactoryx_setcpuaffinity.md)
- [IDStorageFactoryX::SetDebugFlags](/reference/system/dstorage/interfaces/IDStorageFactoryX/methods/idstoragefactoryx_setdebugflags.md)
