Source File
work.go
Belonging Package
github.com/pancsta/d2/d2layouts/d2talalayout/internal/routing
package routingimport// cachedContextErr avoids repeatedly traversing context value wrappers in hot// guarded loops. Standard cancellable contexts close Done before Err becomes// observable; synthetic contexts without Done retain per-call Err polling.func cachedContextErr( context.Context, <-chan struct{}) error {if == nil {return .Err()}select {case <-:return .Err()default:return nil}}// chargeSkippedRouteWork retains the logical work of a linear scan after its// irrelevant prefix has been found by binary search. Nonstandard budgets and// synthetic contexts retain exact step-by-step accounting and cancellation.func chargeSkippedRouteWork( workBudget, int) error {if == nil || == 0 {return nil}, := .(*routeSearchWorkGuard)if ! || .done == nil || .aggregate != nil && !.deferAggregate {for range {if := .step(); != nil {return}}return nil}:= uint64()if .used >= .limit {return .step()}if := .limit - .used; > {if := .add(); != nil {return}return .step()}return .add()}
![]() |
The pages are generated with Golds v0.8.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |