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

# 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](/services/playfab/multiplayer/networking/reference/enums/partythreadid)

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()](/services/playfab/multiplayer/networking/reference/classes/PartyManager/methods/partymanager_geterrormessage).

## 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](/services/playfab/multiplayer/networking/reference/enums/partythreadid). <br /><br /> For all platforms, <b><i>except PlayStation®</i></b>, this method may be called at any time before or after [Initialize()](/services/playfab/multiplayer/networking/reference/classes/PartyManager/methods/partymanager_initialize) and takes effect immediately. **On PlayStation®, attempting to set the processor affinity for the [PartyThreadId](/services/playfab/multiplayer/networking/reference/enums/partythreadid) Audio thread after calling Initialize() can result in audio rendering failures**. It's currently recommended to call this method prior to calling Initialize().   <br /><br /> Thread processor settings are persisted across calls to [Cleanup()](/services/playfab/multiplayer/networking/reference/classes/PartyManager/methods/partymanager_cleanup) and Initialize(). When there are more than 64 cores present, this method always applies to processor group 0.   <br /><br /> 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](/services/playfab/multiplayer/networking/reference/classes/PartyManager/partymanager)\
[PartyThreadId](/services/playfab/multiplayer/networking/reference/enums/partythreadid)\
[PartyManager::GetThreadAffinityMask](/services/playfab/multiplayer/networking/reference/classes/PartyManager/methods/partymanager_getthreadaffinitymask)


## Related topics

- [PartyManager::GetThreadAffinityMask](/services/playfab/multiplayer/networking/reference/classes/PartyManager/methods/partymanager_getthreadaffinitymask.md)
- [PartyThreadId](/services/playfab/multiplayer/networking/reference/enums/partythreadid.md)
- [PartyManager::Initialize](/services/playfab/multiplayer/networking/reference/classes/PartyManager/methods/partymanager_initialize.md)
- [PartyXblManager::SetThreadAffinityMask](/services/playfab/multiplayer/networking/xblreference/classes/PartyXblManager/methods/partyxblmanager_setthreadaffinitymask.md)
- [chat_manager::set_thread_affinity_mask](/reference/chat/gamechat2/classes/chat_manager/methods/chat_manager_set_thread_affinity_mask.md)
