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

# XThreadSetTimeSensitive

> XThreadSetTimeSensitive

# XThreadSetTimeSensitive

Sets or clears a thread as time-sensitive.

## Syntax

```cpp theme={null}
HRESULT XThreadSetTimeSensitive(  
         bool isTimeSensitiveThread  
)  
```

### Parameters

*isTimeSensitiveThread*   \_In\_\
Type: bool

Set to `true` to set the calling thread as time-sensitive; otherwise, `false`.

### Return value

Type: [HRESULT](https://learn.microsoft.com/openspecs/windows_protocols/ms-erref/0642cb2f-2075-4469-918c-4441e69c548a)

Returns `S_OK` if successful; otherwise, returns an error code. For a list of error codes, see [Error Codes](/reference/errorcodes).

## Remarks

This function sets or clears the calling thread as a *time-sensitive thread*, on which blocking or long-running operations should not be performed. This function sets or clears a bit in thread local storage that can be queried by Gaming Runtime Services (GRTS) APIs. Only GRTS APIs that are time-sensitive–safe can be called on a time-sensitive thread. For more information, see [Time-sensitive threads](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads).

Use the [XThreadAssertNotTimeSensitive](/reference/system/xthread/functions/xthreadassertnottimesensitive) function at the beginning of methods that aren't time-sensitive, to break into the debugger if the method is called on a thread that's time-sensitive.

Use the [XThreadIsTimeSensitive](/reference/system/xthread/functions/xthreadistimesensitive) function to test at runtime, as needed, whether the calling thread is time-sensitive.

## Requirements

**Header:** XThread.h

**Library:** xgameruntime.lib

**Supported platforms:** Windows, XBOX One family consoles and XBOX Series consoles

## Conceptual documentation

* [Asynchronous programming design goals and improvements](/build/core-features/common/async/async-whitepaper)
* [Time-sensitive threads](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads)

## See also

[XThread](/reference/system/xthread/xthread_members)\
[Time sensitive threads](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads)


## Related topics

- [XThreadIsTimeSensitive](/reference/system/xthread/functions/xthreadistimesensitive.md)
- [XThread](/reference/system/xthread/xthread_members.md)
- [XThreadAssertNotTimeSensitive](/reference/system/xthread/functions/xthreadassertnottimesensitive.md)
- [XClosedCaptionSetEnabled](/reference/system/xaccessibility/functions/xclosedcaptionsetenabled.md)
- [XErrorSetCallback](/reference/system/xerror/functions/xerrorsetcallback.md)
