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

スレッドを時間依存として設定またはクリアします。

## 構文

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

### パラメーター

*isTimeSensitiveThread*   \_In\_\
Type: bool

呼び出し元のスレッドを時間依存として設定する場合は `true` に、それ以外の場合は `false` に設定します。

### 戻り値

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

成功した場合は `S_OK` を返します。それ以外の場合はエラー コードを返します。エラー コードの一覧については、[エラー コード](/reference/errorcodes) を参照してください。

## 解説

この関数は、呼び出し元のスレッドを *時間依存スレッド* として設定またはクリアします。時間依存スレッドでは、ブロッキングや長時間実行される操作を実行してはいけません。この関数は、Gaming Runtime Services (GRTS) API が照会できるスレッド ローカル ストレージ内のビットを設定またはクリアします。時間依存で安全な GRTS API のみが、時間依存スレッドから呼び出せます。詳細については、[Time-sensitive threads](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads) を参照してください。

時間依存でないメソッドの先頭で [XThreadAssertNotTimeSensitive](/reference/system/xthread/functions/xthreadassertnottimesensitive) 関数を使用すると、そのメソッドが時間依存スレッドから呼び出された場合にデバッガーに割り込むことができます。

必要に応じて、呼び出し元スレッドが時間依存かどうかを実行時にテストするには、[XThreadIsTimeSensitive](/reference/system/xthread/functions/xthreadistimesensitive) 関数を使用します。

## 要件

**ヘッダー:** XThread.h

**ライブラリ:** xgameruntime.lib

**サポートされているプラットフォーム:** Windows、XBOX One 本体、XBOX Series 本体

## 概念ドキュメント

* [非同期プログラミングの設計目標と改善点](/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)

## 関連項目

[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](/ja-jp/reference/system/xthread/functions/xthreadistimesensitive.md)
- [XThread](/ja-jp/reference/system/xthread/xthread_members.md)
- [XThreadAssertNotTimeSensitive](/ja-jp/reference/system/xthread/functions/xthreadassertnottimesensitive.md)
- [XErrorSetCallback](/ja-jp/reference/system/xerror/functions/xerrorsetcallback.md)
- [XErrorSetOptions](/ja-jp/reference/system/xerror/functions/xerrorsetoptions.md)
