This commit is contained in:
2026-09-17 10:22:49 +08:00
parent bfa3106a69
commit 8f2d00155b
41 changed files with 4244 additions and 698 deletions
@@ -1074,7 +1074,8 @@ task representing this disposal (see <a class="xref" href="Hi.Cbtr.CubeTree.html
<div class="markdown level1 summary"><p>Enqueues disposal of objects retired alongside a tree (typically its attachments) on
the SAME serialized chain as <a class="xref" href="Hi.Cbtr.CubeTree.html#Hi_Cbtr_CubeTree_DisposeBackground">DisposeBackground()</a>, so there is a single
drain point (<a class="xref" href="Hi.Cbtr.CubeTree.html#Hi_Cbtr_CubeTree_WaitForPendingDisposals">WaitForPendingDisposals()</a>). Disposing a <a class="xref" href="Hi.Cbtr.CbtrPickable.html">CbtrPickable</a>
drain point (<a class="xref" href="Hi.Cbtr.CubeTree.html#Hi_Cbtr_CubeTree_DrainAndCloseBackgroundDisposals">DrainAndCloseBackgroundDisposals()</a> at application end,
<a class="xref" href="Hi.Cbtr.CubeTree.html#Hi_Cbtr_CubeTree_WaitForPendingDisposals">WaitForPendingDisposals()</a> for a snapshot). Disposing a <a class="xref" href="Hi.Cbtr.CbtrPickable.html">CbtrPickable</a>
now clears its (possibly huge) attached node map — O(nodes) — which must not run on the
hot path. Enqueue the owning tree's <a class="xref" href="Hi.Cbtr.CubeTree.html#Hi_Cbtr_CubeTree_DisposeBackground">DisposeBackground()</a> <em>first</em> so the
gated tree teardown (which waits out in-flight renders) runs before its attachments are freed.</p>
@@ -1107,6 +1108,67 @@ gated tree teardown (which waits out in-flight renders) runs before its attachme
<a id="Hi_Cbtr_CubeTree_DrainAndCloseBackgroundDisposals_" data-uid="Hi.Cbtr.CubeTree.DrainAndCloseBackgroundDisposals*"></a>
<h3 id="Hi_Cbtr_CubeTree_DrainAndCloseBackgroundDisposals" data-uid="Hi.Cbtr.CubeTree.DrainAndCloseBackgroundDisposals">
DrainAndCloseBackgroundDisposals()
</h3>
<div class="markdown level1 summary"><p><a class="xref" href="Hi.Cbtr.CubeTree.html#Hi_Cbtr_CubeTree_DrainBackgroundDisposals">DrainBackgroundDisposals()</a>, then closes the chain: every
<a class="xref" href="Hi.Cbtr.CubeTree.html#Hi_Cbtr_CubeTree_DisposeBackground">DisposeBackground()</a> from here on frees inline on its caller.
Call it once at application end, before the native library is torn down &ndash;
after it, no disposal can be left running on a thread nobody waits for.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static void DrainAndCloseBackgroundDisposals()</code></pre>
</div>
<a id="Hi_Cbtr_CubeTree_DrainBackgroundDisposals_" data-uid="Hi.Cbtr.CubeTree.DrainBackgroundDisposals*"></a>
<h3 id="Hi_Cbtr_CubeTree_DrainBackgroundDisposals" data-uid="Hi.Cbtr.CubeTree.DrainBackgroundDisposals">
DrainBackgroundDisposals()
</h3>
<div class="markdown level1 summary"><p>Blocks until the background disposal chain is empty &ndash; including entries queued
by other threads while it was waiting, which a single
<a class="xref" href="Hi.Cbtr.CubeTree.html#Hi_Cbtr_CubeTree_WaitForPendingDisposals">WaitForPendingDisposals()</a> snapshot does not cover. A drain that can
return with work still queued is not a drain; the callers that queue at shutdown
are stopped by the host before this runs (see <a class="xref" href="Hi.Cbtr.CubeTree.html#Hi_Cbtr_CubeTree_DrainAndCloseBackgroundDisposals">DrainAndCloseBackgroundDisposals()</a>).</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static void DrainBackgroundDisposals()</code></pre>
</div>
<a id="Hi_Cbtr_CubeTree_ExpandToBox3d_" data-uid="Hi.Cbtr.CubeTree.ExpandToBox3d*"></a>
<h3 id="Hi_Cbtr_CubeTree_ExpandToBox3d_Hi_Geom_Box3d_" data-uid="Hi.Cbtr.CubeTree.ExpandToBox3d(Hi.Geom.Box3d)">
@@ -1829,8 +1891,9 @@ This function put <code class="paramref">src</code> to the nodes that contain nu
</h3>
<div class="markdown level1 summary"><p>A task that completes when all queued background disposals have finished.
Await this at application shutdown before the native dll is unloaded.</p>
<div class="markdown level1 summary"><p>A task that completes when every background disposal queued SO FAR has finished -
a snapshot: anything queued after the call is not covered. Application end must
use <a class="xref" href="Hi.Cbtr.CubeTree.html#Hi_Cbtr_CubeTree_DrainAndCloseBackgroundDisposals">DrainAndCloseBackgroundDisposals()</a> instead.</p>
</div>
<div class="markdown level1 conceptual"></div>