> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# PartyManager::SetThreadAffinityMask

> Optionally configures the processor on which internal Party library threads run.

Optionally configures the processor on which internal Party library threads run.

## Syntax

```cpp theme={null}
PartyError SetThreadAffinityMask(  
    PartyThreadId threadId,  
    uint64_t threadAffinityMask  
)  
```

### Parameters

**`threadId`**   [PartyThreadId](https://docs.xbox.com/services/playfab/multiplayer/networking/reference/enums/partythreadid.md)

The type of internal Party library thread to configure processor affinity.

**`threadAffinityMask`**   uint64\_t

The affinity mask for this type of Party library thread.

### Return value

PartyError

`c_partyErrorSuccess` if the call succeeded or an error code otherwise. The human-readable form of the error code can be retrieved via [GetErrorMessage()](https://docs.xbox.com/services/playfab/multiplayer/networking/reference/classes/PartyManager/methods/partymanager_geterrormessage.md).

## Remarks

This method enables the title to configure the processor affinity for internal Party library threads of a given type. On Windows, the `Audio` type affects both the PlayFab Party library owned threads and threads owned by XAudio2. For more information, see [PartyThreadId](https://docs.xbox.com/services/playfab/multiplayer/networking/reference/enums/partythreadid.md). \
\
&#x20;For all platforms, ***except PlayStation®***, this method may be called at any time before or after [Initialize()](https://docs.xbox.com/services/playfab/multiplayer/networking/reference/classes/PartyManager/methods/partymanager_initialize.md) and takes effect immediately. **On PlayStation®, attempting to set the processor affinity for the [PartyThreadId](https://docs.xbox.com/services/playfab/multiplayer/networking/reference/enums/partythreadid.md) Audio thread after calling Initialize() can result in audio rendering failures**. It's currently recommended to call this method prior to calling Initialize().   \
\
&#x20;Thread processor settings are persisted across calls to [Cleanup()](https://docs.xbox.com/services/playfab/multiplayer/networking/reference/classes/PartyManager/methods/partymanager_cleanup.md) and Initialize(). When there are more than 64 cores present, this method always applies to processor group 0.   \
\
&#x20;In order to specify any processor, pass `c_anyProcessor` as the `threadAffinityMask` parameter. `c_anyProcessor` is also the default value the Party library uses if this method is never called.

## Requirements

**Header:** Party.h

## See also

[PartyManager](https://docs.xbox.com/services/playfab/multiplayer/networking/reference/classes/PartyManager/partymanager.md)\
[PartyThreadId](https://docs.xbox.com/services/playfab/multiplayer/networking/reference/enums/partythreadid.md)\
[PartyManager::GetThreadAffinityMask](https://docs.xbox.com/services/playfab/multiplayer/networking/reference/classes/PartyManager/methods/partymanager_getthreadaffinitymask.md)


## Related topics

- [PartyManager::GetThreadAffinityMask](https://docs.xbox.com/services/playfab/multiplayer/networking/reference/classes/PartyManager/methods/partymanager_getthreadaffinitymask.md)
- [PartyThreadId](https://docs.xbox.com/services/playfab/multiplayer/networking/reference/enums/partythreadid.md)
- [PartyManager::Initialize](https://docs.xbox.com/services/playfab/multiplayer/networking/reference/classes/PartyManager/methods/partymanager_initialize.md)
- [PartyXblManager::SetThreadAffinityMask](https://docs.xbox.com/services/playfab/multiplayer/networking/xblreference/classes/PartyXblManager/methods/partyxblmanager_setthreadaffinitymask.md)
- [PartyXblManager::GetThreadAffinityMask](https://docs.xbox.com/services/playfab/multiplayer/networking/xblreference/classes/PartyXblManager/methods/partyxblmanager_getthreadaffinitymask.md)
