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

Sets a CPU affinity mask for DirectStorage.

## Syntax

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

### Parameters

*affinity*\
Type: UINT64

The CPU affinity mask.

### Return value

Type: HRESULT

Standard HRESULT error code.

## Remarks

DirectStorage normally performs work in the calling thread. However, some work can't be performed in the calling thread. To restrict such work to a specified set of CPU cores, set a CPU affinity mask.

For more information, see "SetCPUAffinity" in the "IDStorageFileX" section in [DirectStorage Overview](/build/console-features/storage/directstorage/directstorage-overview).

## Requirements

**Header:** dstorage\_xs.h

**Library:** dstorage\_xs.lib

**Supported platforms:** XBOX Series consoles

## See also

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


## Related topics

- [IDStorageFactoryX::SetDebugFlags](/reference/system/dstorage/interfaces/IDStorageFactoryX/methods/idstoragefactoryx_setdebugflags.md)
- [IDStorageFactoryX::SetStagingBufferSize](/reference/system/dstorage/interfaces/IDStorageFactoryX/methods/idstoragefactoryx_setstagingbuffersize.md)
- [IDStorageFactoryX](/reference/system/dstorage/interfaces/IDStorageFactoryX/idstoragefactoryx.md)
- [DirectStorage Overview](/build/console-features/storage/directstorage/directstorage-overview.md)
- [IDStorageFactoryX::CreateQueue](/reference/system/dstorage/interfaces/IDStorageFactoryX/methods/idstoragefactoryx_createqueue.md)
