@prefix schema: <https://schema.org/> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix ks: <https://comcomponent.com/vocab/> .

<https://comcomponent.com/blog/multithreading-best-practices-c/#article>
    schema:about <https://comcomponent.com/knowledge/shared-mutable-state/>, <https://comcomponent.com/knowledge/race-condition/> ;
    schema:mentions <https://comcomponent.com/knowledge/deadlock/>, <https://comcomponent.com/knowledge/beginthreadex/>, <https://comcomponent.com/knowledge/createthread-api/>, <https://comcomponent.com/knowledge/c-runtime-library/>, <https://comcomponent.com/knowledge/windows-thread-pool/>, <https://comcomponent.com/knowledge/backpressure/>, <https://comcomponent.com/knowledge/thread-local-state/>, <https://comcomponent.com/knowledge/srw-lock/>, <https://comcomponent.com/knowledge/critical-section/>, <https://comcomponent.com/knowledge/win32-mutex-object/>, <https://comcomponent.com/knowledge/in-process-mutual-exclusion/>, <https://comcomponent.com/knowledge/interlocked-functions/>, <https://comcomponent.com/knowledge/variable-alignment/>, <https://comcomponent.com/knowledge/volatile-keyword/>, <https://comcomponent.com/knowledge/win32-condition-variable/>, <https://comcomponent.com/knowledge/spurious-wakeup/>, <https://comcomponent.com/knowledge/polling-wait/>, <https://comcomponent.com/knowledge/terminatethread/>, <https://comcomponent.com/knowledge/stop-event-pattern/>, <https://comcomponent.com/knowledge/cooperative-cancellation/>, <https://comcomponent.com/knowledge/lock-ordering/>, <https://comcomponent.com/knowledge/dllmain-loader-lock/>, <https://comcomponent.com/knowledge/c11-threads/>, <https://comcomponent.com/knowledge/windows-only-codebase/>, <https://comcomponent.com/knowledge/bounded-buffer/> .

<https://comcomponent.com/knowledge/shared-mutable-state/> a skos:Concept ;
    skos:prefLabel "共有可変状態"@ja ;
    skos:definition "複数のスレッドから読み書きされる、書き換え可能なデータ。競合はこれと複数スレッドが揃ったときにだけ起きる。"@ja ;
    ks:mayCause <https://comcomponent.com/knowledge/race-condition/> .

<https://comcomponent.com/knowledge/race-condition/> a skos:Concept ;
    skos:prefLabel "競合状態(race condition)"@ja ;
    skos:definition "複数のスレッドがどの順序で特定のコードに到達するかによって結果が変わってしまう不具合。"@ja ;
    skos:altLabel "レースコンディション"@ja .

<https://comcomponent.com/knowledge/createthread-api/> a skos:Concept ;
    skos:prefLabel "CreateThread"@ja ;
    skos:definition "スレッドを作成するWin32のネイティブAPI。CRTのスレッドごとデータは初期化しない。"@ja ;
    ks:incompatibleWith <https://comcomponent.com/knowledge/c-runtime-library/> .

<https://comcomponent.com/knowledge/c-runtime-library/> a skos:Concept ;
    skos:prefLabel "CRT(Cランタイムライブラリ)"@ja ;
    skos:definition "printfやmallocなど、C言語の標準ライブラリ関数を提供する実行時ライブラリ。スレッドごとの内部データを持つ。"@ja ;
    skos:altLabel "CRT" .

<https://comcomponent.com/knowledge/beginthreadex/> a skos:Concept ;
    skos:prefLabel "_beginthreadex"@ja ;
    skos:definition "CRTがスレッドごとに使う内部データを初期化してからスレッドを開始する、CRT提供のスレッド作成関数。返したハンドルは呼び出し側がCloseHandleで閉じる。"@ja ;
    ks:implements <https://comcomponent.com/knowledge/c-runtime-library/> .

<https://comcomponent.com/knowledge/windows-thread-pool/> a skos:Concept ;
    skos:prefLabel "Windowsスレッドプール"@ja ;
    skos:definition "CreateThreadpoolWorkで作った仕事オブジェクトをSubmitThreadpoolWorkで投函すると、プールのワーカースレッドがコールバックを実行するWindowsの仕組み。"@ja ;
    ks:incompatibleWith <https://comcomponent.com/knowledge/terminatethread/> .

<https://comcomponent.com/knowledge/terminatethread/> a skos:Concept ;
    skos:prefLabel "TerminateThread"@ja ;
    skos:definition "対象スレッドにユーザーモードコードを一切実行させずに終了させるWin32 API。"@ja ;
    ks:mayCause <https://comcomponent.com/knowledge/deadlock/> .

<https://comcomponent.com/knowledge/backpressure/> a skos:Concept ;
    skos:prefLabel "backpressure"@ja ;
    skos:definition "流し込みが速すぎるときに、書き込み側を待たせて増えすぎを防ぐ仕組み。"@ja ;
    skos:altLabel "バックプレッシャー"@ja .

<https://comcomponent.com/knowledge/srw-lock/> a skos:Concept ;
    skos:prefLabel "SRWロック(Slim Reader/Writer Lock)"@ja ;
    skos:definition "Win32が提供する軽量な読み書きロック。再帰取得はできない。"@ja ;
    skos:altLabel "SRWLOCK" ;
    ks:recommendedFor <https://comcomponent.com/knowledge/in-process-mutual-exclusion/> .

<https://comcomponent.com/knowledge/in-process-mutual-exclusion/> a skos:Concept ;
    skos:prefLabel "プロセス内の相互排他"@ja ;
    skos:definition "同一プロセス内のスレッド間で、共有データへのアクセスを排他したいという要件。"@ja .

<https://comcomponent.com/knowledge/critical-section/> a skos:Concept ;
    skos:prefLabel "CRITICAL_SECTION"@ja ;
    skos:definition "スピンしてからカーネル待機に落ちる、プロセス内専用のWin32ロック。同一スレッドの再帰取得ができる。"@ja .

<https://comcomponent.com/knowledge/win32-mutex-object/> a skos:Concept ;
    skos:prefLabel "Win32のMutexオブジェクト"@ja ;
    skos:definition "常にカーネルオブジェクトとして作られるWin32の相互排他オブジェクト。名前を付ければプロセスをまたいで開き直せる。"@ja ;
    ks:notRecommendedFor <https://comcomponent.com/knowledge/in-process-mutual-exclusion/> .

<https://comcomponent.com/knowledge/interlocked-functions/> a skos:Concept ;
    skos:prefLabel "Interlocked関数"@ja ;
    skos:definition "複数スレッドで共有される変数へのアクセスを同期し、読み込み・加算・書き戻しのような操作を不可分に行うWin32の関数群。"@ja ;
    ks:prevents <https://comcomponent.com/knowledge/race-condition/> ;
    ks:requires <https://comcomponent.com/knowledge/variable-alignment/> .

<https://comcomponent.com/knowledge/variable-alignment/> a skos:Concept ;
    skos:prefLabel "変数の整列(アラインメント)"@ja ;
    skos:definition "変数が自然な境界(32ビット値なら4バイト、64ビット値なら8バイト)に配置されていること。"@ja .

<https://comcomponent.com/knowledge/volatile-keyword/> a skos:Concept ;
    skos:prefLabel "volatile"@ja ;
    skos:definition "最適化による読み書きの除去を抑える型修飾子。スレッド間の同期を保証するものではない。"@ja ;
    ks:notRecommendedFor <https://comcomponent.com/knowledge/race-condition/> .

<https://comcomponent.com/knowledge/thread-local-state/> a skos:Concept ;
    skos:prefLabel "スレッドローカル状態"@ja ;
    skos:definition "各スレッドが自分だけの領域に持つ中間状態。並列ループで共有メモリへ書き込まずに集計するために使う。"@ja .

<https://comcomponent.com/knowledge/win32-condition-variable/> a skos:Concept ;
    skos:prefLabel "Win32の条件変数"@ja ;
    skos:definition "InitializeConditionVariableで作り、SleepConditionVariableCS／SRWで待ち、WakeConditionVariableで起こすWin32の待ち合わせ機構。"@ja ;
    ks:uses <https://comcomponent.com/knowledge/critical-section/> ;
    ks:mayCause <https://comcomponent.com/knowledge/spurious-wakeup/> ;
    ks:succeeds <https://comcomponent.com/knowledge/polling-wait/> .

<https://comcomponent.com/knowledge/spurious-wakeup/> a skos:Concept ;
    skos:prefLabel "スプリアスウェイクアップ"@ja ;
    skos:definition "通知がないのに条件変数の待機から目覚めてしまう現象。"@ja .

<https://comcomponent.com/knowledge/bounded-buffer/> a skos:Concept ;
    skos:prefLabel "有限バッファー"@ja ;
    skos:definition "容量に上限を設けたキュー・循環バッファー。満杯になったら生産側を待たせることが自然な背圧になる。"@ja ;
    ks:implements <https://comcomponent.com/knowledge/backpressure/> .

<https://comcomponent.com/knowledge/polling-wait/> a skos:Concept ;
    skos:prefLabel "ポーリングによる待機"@ja ;
    skos:definition "フラグが立つまで短い休止を挟んだループで確認し続ける待ち方。"@ja .

<https://comcomponent.com/knowledge/deadlock/> a skos:Concept ;
    skos:prefLabel "デッドロック(deadlock)"@ja ;
    skos:definition "複数のタスクが互いの完了やリソース解放を待ち続け、永遠に進行しなくなる状態である。"@ja ;
    skos:altLabel "Deadlock" .

<https://comcomponent.com/knowledge/stop-event-pattern/> a skos:Concept ;
    skos:prefLabel "停止イベント+WaitForMultipleObjects"@ja ;
    skos:definition "手動リセットの停止イベントを1つ作り、各ワーカーが「仕事の合図」と「停止の合図」を同時に待つ、Win32での協調停止の定石。"@ja ;
    ks:succeeds <https://comcomponent.com/knowledge/terminatethread/> ;
    ks:implements <https://comcomponent.com/knowledge/cooperative-cancellation/> .

<https://comcomponent.com/knowledge/cooperative-cancellation/> a skos:Concept ;
    skos:prefLabel "協調キャンセル"@ja ;
    skos:definition "キャンセルを強制ではなく要求として伝え、停止の仕方はリスナー側が決めるモデル。"@ja .

<https://comcomponent.com/knowledge/lock-ordering/> a skos:Concept ;
    skos:prefLabel "ロック取得順序の統一"@ja ;
    skos:definition "複数のロックを取るとき、全スレッドが同じ順序で取ると決めるルール。"@ja ;
    ks:prevents <https://comcomponent.com/knowledge/deadlock/> .

<https://comcomponent.com/knowledge/dllmain-loader-lock/> a skos:Concept ;
    skos:prefLabel "DllMainとローダーロック"@ja ;
    skos:definition "DllMainがローダーロックを保持した状態で呼ばれるという制約。呼べるAPIが大きく限られる。"@ja ;
    ks:mayCause <https://comcomponent.com/knowledge/deadlock/> .

<https://comcomponent.com/knowledge/c11-threads/> a skos:Concept ;
    skos:prefLabel "C11スレッド(<threads.h>)"@ja ;
    skos:definition "thrd_create・mtx_lock・cnd_waitなどからなる、C11標準の移植可能なスレッドAPI。"@ja .

<https://comcomponent.com/knowledge/windows-only-codebase/> a skos:Concept ;
    skos:prefLabel "Windows専用のコードベース"@ja ;
    skos:definition "LinuxなどWindows以外への移植を想定しないコードベース。移植性のための抽象より、プラットフォーム固有APIの直接利用が現実的になる。"@ja .

[] a rdf:Statement ;
    rdf:subject <https://comcomponent.com/knowledge/shared-mutable-state/> ;
    rdf:predicate ks:mayCause ;
    rdf:object <https://comcomponent.com/knowledge/race-condition/> ;
    schema:description "count++は読み込み・加算・書き戻しの3ステップに分かれるため、同期がなければ2つのスレッドの加算のうち一方が失われる。"@ja ;
    ks:evidence <https://learn.microsoft.com/windows/win32/sync/interlocked-variable-access> ;
    ks:verifiedAt "2026-08-02" ;
    ks:certainty "established" .

[] a rdf:Statement ;
    rdf:subject <https://comcomponent.com/knowledge/createthread-api/> ;
    rdf:predicate ks:incompatibleWith ;
    rdf:object <https://comcomponent.com/knowledge/c-runtime-library/> ;
    schema:description "CRTを呼ぶ実行ファイル内のスレッドはCreateThread / ExitThreadではなく_beginthreadex / _endthreadexで管理すべきで、CreateThreadで作ったスレッドがCRTを呼ぶと低メモリ状態でCRTがプロセスを終了させることがある。"@ja ;
    ks:evidence <https://learn.microsoft.com/windows/win32/api/processthreadsapi/nf-processthreadsapi-createthread>, <https://learn.microsoft.com/cpp/parallel/multithreading-with-c-and-win32> ;
    ks:verifiedAt "2026-08-02" ;
    ks:certainty "established" .

[] a rdf:Statement ;
    rdf:subject <https://comcomponent.com/knowledge/beginthreadex/> ;
    rdf:predicate ks:implements ;
    rdf:object <https://comcomponent.com/knowledge/c-runtime-library/> ;
    schema:description "_beginthreadex系はCRTのスレッドごと変数を初期化してからスレッドを開始する。_beginthread(exなし)は作ったスレッドが早く終了すると返却済みハンドルが無効になり別スレッドを指しうるため、同期APIにハンドルを渡せる_beginthreadexのほうが安全である。"@ja ;
    ks:evidence <https://learn.microsoft.com/cpp/c-runtime-library/reference/beginthread-beginthreadex>, <https://learn.microsoft.com/cpp/parallel/multithreading-with-c-and-win32> ;
    ks:verifiedAt "2026-08-02" ;
    ks:certainty "established" .

[] a rdf:Statement ;
    rdf:subject <https://comcomponent.com/knowledge/windows-thread-pool/> ;
    rdf:predicate ks:succeeds ;
    rdf:object <https://comcomponent.com/knowledge/createthread-api/> ;
    schema:description "短い仕事を大量に非同期実行するアプリや短命スレッドを頻繁に作るアプリにはスレッドプールが適する。CreateThreadpoolWorkで仕事オブジェクトを作り、SubmitThreadpoolWorkを呼ぶたびにプールのワーカースレッドがコールバックを実行する。"@ja ;
    ks:evidence <https://learn.microsoft.com/windows/win32/api/threadpoolapiset/nf-threadpoolapiset-createthreadpoolwork>, <https://learn.microsoft.com/windows/win32/procthread/thread-pools> ;
    ks:verifiedAt "2026-08-02" ;
    ks:certainty "context-dependent" .

[] a rdf:Statement ;
    rdf:subject <https://comcomponent.com/knowledge/windows-thread-pool/> ;
    rdf:predicate ks:incompatibleWith ;
    rdf:object <https://comcomponent.com/knowledge/terminatethread/> ;
    schema:description "スレッドプールのベストプラクティスとして、プールのスレッドをTerminateThreadやExitThreadで終わらせてはならないとされている。"@ja ;
    ks:evidence <https://learn.microsoft.com/windows/win32/procthread/thread-pools> ;
    ks:verifiedAt "2026-08-02" ;
    ks:certainty "established" .

[] a rdf:Statement ;
    rdf:subject <https://comcomponent.com/knowledge/windows-thread-pool/> ;
    rdf:predicate ks:requires ;
    rdf:object <https://comcomponent.com/knowledge/backpressure/> ;
    schema:description "プールが制限するのはワーカースレッドの数だけで、投函された未実行のコールバックは積み上がる。投入が処理を上回り続ける構成では、アプリ側にセマフォなどの入場制限か容量付きキューを置いて、満杯時に投入側が待つ形にする。"@ja ;
    ks:evidence <https://learn.microsoft.com/windows/win32/procthread/thread-pools> ;
    ks:verifiedAt "2026-08-02" ;
    ks:certainty "context-dependent" .

[] a rdf:Statement ;
    rdf:subject <https://comcomponent.com/knowledge/srw-lock/> ;
    rdf:predicate ks:recommendedFor ;
    rdf:object <https://comcomponent.com/knowledge/in-process-mutual-exclusion/> ;
    schema:description "SRWロックは新規コードの既定で、ポインターサイズかつ通常はユーザーモードで完結する。AcquireSRWLockSharedで読み取り共有も取れる。"@ja ;
    ks:evidence <https://learn.microsoft.com/windows/win32/sync/about-synchronization> ;
    ks:verifiedAt "2026-08-02" ;
    ks:certainty "established" .

[] a rdf:Statement ;
    rdf:subject <https://comcomponent.com/knowledge/critical-section/> ;
    rdf:predicate ks:recommendedFor ;
    rdf:object <https://comcomponent.com/knowledge/in-process-mutual-exclusion/> ;
    schema:description "CRITICAL_SECTIONは、同一スレッドによる再帰取得が必要な場合に選ぶ。"@ja ;
    ks:evidence <https://learn.microsoft.com/windows/win32/sync/about-synchronization> ;
    ks:verifiedAt "2026-08-02" ;
    ks:certainty "context-dependent" .

[] a rdf:Statement ;
    rdf:subject <https://comcomponent.com/knowledge/win32-mutex-object/> ;
    rdf:predicate ks:notRecommendedFor ;
    rdf:object <https://comcomponent.com/knowledge/in-process-mutual-exclusion/> ;
    schema:description "Mutexは常にカーネルオブジェクトなので、プロセス内の排他に使うのは低速でよくある間違いとされている。プロセスをまたぐ排他やWaitForMultipleObjectsとの併用が本来の出番になる。"@ja ;
    ks:evidence <https://learn.microsoft.com/windows/win32/sync/about-synchronization> ;
    ks:verifiedAt "2026-08-02" ;
    ks:certainty "established" .

[] a rdf:Statement ;
    rdf:subject <https://comcomponent.com/knowledge/interlocked-functions/> ;
    rdf:predicate ks:prevents ;
    rdf:object <https://comcomponent.com/knowledge/race-condition/> ;
    schema:description "InterlockedIncrement / Decrementは読み込み・加算・書き戻しを1つの原子操作に束ねる。同期がなければ2つのスレッドの更新が食い違う。"@ja ;
    ks:evidence <https://learn.microsoft.com/windows/win32/sync/interlocked-variable-access> ;
    ks:verifiedAt "2026-08-02" ;
    ks:certainty "established" .

[] a rdf:Statement ;
    rdf:subject <https://comcomponent.com/knowledge/interlocked-functions/> ;
    rdf:predicate ks:requires ;
    rdf:object <https://comcomponent.com/knowledge/variable-alignment/> ;
    schema:description "適切に整列された32ビット変数の単純な読み書きはアトミックだがアクセスの順序は保証されず、64ビット変数の単純な読み書きは32ビットWindowsではアトミックにならない。Interlockedの対象変数は自然な境界に整列している必要がある。"@ja ;
    ks:evidence <https://learn.microsoft.com/windows/win32/sync/interlocked-variable-access> ;
    ks:verifiedAt "2026-08-02" ;
    ks:certainty "established" .

[] a rdf:Statement ;
    rdf:subject <https://comcomponent.com/knowledge/volatile-keyword/> ;
    rdf:predicate ks:notRecommendedFor ;
    rdf:object <https://comcomponent.com/knowledge/race-condition/> ;
    schema:description "volatileは原子性も順序も保証しない。共有カウンターやフラグの更新にはInterlocked系を使う。"@ja ;
    ks:evidence <https://learn.microsoft.com/windows/win32/sync/interlocked-variable-access> ;
    ks:verifiedAt "2026-08-02" ;
    ks:certainty "established" .

[] a rdf:Statement ;
    rdf:subject <https://comcomponent.com/knowledge/thread-local-state/> ;
    rdf:predicate ks:mitigates ;
    rdf:object <https://comcomponent.com/knowledge/shared-mutable-state/> ;
    schema:description "並列集計では共有カウンターに毎回書き込まず、スレッドごとのローカル変数に小計を作って終了時に1回だけInterlockedAddで合流させる。共有への書き込みが反復のたびからスレッドごとに1回へ減る。"@ja ;
    ks:evidence <https://learn.microsoft.com/windows/win32/sync/interlocked-variable-access> ;
    ks:verifiedAt "2026-08-22" ;
    ks:certainty "context-dependent" .

[] a rdf:Statement ;
    rdf:subject <https://comcomponent.com/knowledge/win32-condition-variable/> ;
    rdf:predicate ks:uses ;
    rdf:object <https://comcomponent.com/knowledge/critical-section/> ;
    schema:description "公式の実装例では、CRITICAL_SECTIONで保護した有限循環バッファーに対して、消費側がSleepConditionVariableCSで待ち、生産側がWakeConditionVariableで起こす。SRWロックと組む場合はSleepConditionVariableSRWを使う。"@ja ;
    ks:evidence <https://learn.microsoft.com/windows/win32/sync/using-condition-variables> ;
    ks:verifiedAt "2026-08-22" ;
    ks:certainty "established" .

[] a rdf:Statement ;
    rdf:subject <https://comcomponent.com/knowledge/win32-condition-variable/> ;
    rdf:predicate ks:mayCause ;
    rdf:object <https://comcomponent.com/knowledge/spurious-wakeup/> ;
    schema:description "目覚めたら必ずロック内で条件を再確認し、偽ならwaitに戻るループにする。通知なしに目覚めることがあり、目覚めた時には別の消費者が要素を先取りしていることもある。"@ja ;
    ks:evidence <https://learn.microsoft.com/windows/win32/sync/using-condition-variables> ;
    ks:verifiedAt "2026-08-02" ;
    ks:certainty "established" .

[] a rdf:Statement ;
    rdf:subject <https://comcomponent.com/knowledge/bounded-buffer/> ;
    rdf:predicate ks:implements ;
    rdf:object <https://comcomponent.com/knowledge/backpressure/> ;
    schema:description "容量に上限のある有限循環バッファーは、生産が消費を追い越したら生産側が待つという自然な背圧になる。"@ja ;
    ks:evidence <https://learn.microsoft.com/windows/win32/sync/using-condition-variables> ;
    ks:verifiedAt "2026-08-22" ;
    ks:certainty "established" .

[] a rdf:Statement ;
    rdf:subject <https://comcomponent.com/knowledge/win32-condition-variable/> ;
    rdf:predicate ks:succeeds ;
    rdf:object <https://comcomponent.com/knowledge/polling-wait/> ;
    schema:description "SleepのポーリングループはCPUと応答性の両方を無駄にする。条件変数やイベント待機ならシグナルまでスレッドを休ませられる。"@ja ;
    ks:evidence <https://learn.microsoft.com/windows/win32/sync/using-condition-variables> ;
    ks:verifiedAt "2026-08-02" ;
    ks:certainty "established" .

[] a rdf:Statement ;
    rdf:subject <https://comcomponent.com/knowledge/terminatethread/> ;
    rdf:predicate ks:mayCause ;
    rdf:object <https://comcomponent.com/knowledge/deadlock/> ;
    schema:description "TerminateThreadは対象スレッドにユーザーモードコードを一切実行させずに終了させるため、対象がクリティカルセクションを保持していれば永遠に解放されず、ヒープ操作中ならヒープロックが握られたままになる。DLLのグローバル状態を操作中ならDLLの状態も破壊される。"@ja ;
    ks:evidence <https://learn.microsoft.com/windows/win32/api/processthreadsapi/nf-processthreadsapi-terminatethread> ;
    ks:verifiedAt "2026-08-02" ;
    ks:certainty "established" .

[] a rdf:Statement ;
    rdf:subject <https://comcomponent.com/knowledge/stop-event-pattern/> ;
    rdf:predicate ks:succeeds ;
    rdf:object <https://comcomponent.com/knowledge/terminatethread/> ;
    schema:description "コード分析警告C6258はTerminateThreadの使用を検出し、正しい終了方法としてCreateEventでイベントを作り、各スレッドがWaitForSingleObjectでイベント状態を監視して自分で終わる形を案内している。"@ja ;
    ks:evidence <https://learn.microsoft.com/cpp/code-quality/c6258>, <https://learn.microsoft.com/windows/win32/api/processthreadsapi/nf-processthreadsapi-terminatethread> ;
    ks:verifiedAt "2026-08-02" ;
    ks:certainty "established" .

[] a rdf:Statement ;
    rdf:subject <https://comcomponent.com/knowledge/stop-event-pattern/> ;
    rdf:predicate ks:implements ;
    rdf:object <https://comcomponent.com/knowledge/cooperative-cancellation/> ;
    schema:description "手動リセットの停止イベントを1つ作り、各ワーカーが仕事の合図と停止の合図を同時に待つことで、ブロッキング待機中のスレッドも停止要求で起こせる。"@ja ;
    ks:evidence <https://learn.microsoft.com/cpp/code-quality/c6258> ;
    ks:verifiedAt "2026-08-02" ;
    ks:certainty "established" .

[] a rdf:Statement ;
    rdf:subject <https://comcomponent.com/knowledge/lock-ordering/> ;
    rdf:predicate ks:prevents ;
    rdf:object <https://comcomponent.com/knowledge/deadlock/> ;
    schema:description "順序の逆転(lock order inversion)がデバッグ困難なデッドロックを生むため、ロック階層を定義して一貫して従うべきことがDLLのベストプラクティス文書に明文化されている。"@ja ;
    ks:evidence <https://learn.microsoft.com/windows/win32/dlls/dynamic-link-library-best-practices> ;
    ks:verifiedAt "2026-08-02" ;
    ks:certainty "established" .

[] a rdf:Statement ;
    rdf:subject <https://comcomponent.com/knowledge/dllmain-loader-lock/> ;
    rdf:predicate ks:mayCause ;
    rdf:object <https://comcomponent.com/knowledge/deadlock/> ;
    schema:description "DllMainはローダーロックを保持したまま呼ばれるため、その中で他スレッドと同期する・スレッドの終了を待つ・LoadLibraryを呼ぶといった操作はデッドロックを招く。スレッドを持つDLLは明示的な初期化・終了関数を公開し、DllMainは空に近いスタブにする。"@ja ;
    ks:evidence <https://learn.microsoft.com/windows/win32/dlls/dynamic-link-library-best-practices> ;
    ks:verifiedAt "2026-08-02" ;
    ks:certainty "established" .

[] a rdf:Statement ;
    rdf:subject <https://comcomponent.com/knowledge/c11-threads/> ;
    rdf:predicate ks:notRecommendedFor ;
    rdf:object <https://comcomponent.com/knowledge/windows-only-codebase/> ;
    schema:description "MSVCの適合表では<threads.h>がVisual Studio 2022 17.8でサポートされた一方、<stdatomic.h>は/experimental:c11atomicsを要するexperimental扱いである。Windows専用のコードベースならWin32の流儀のほうが現実的になる。"@ja ;
    ks:evidence <https://learn.microsoft.com/cpp/overview/visual-cpp-language-conformance> ;
    ks:verifiedAt "2026-08-22" ;
    ks:certainty "context-dependent" .
