サンプル
Handle semaphore weighted acquisition, FIFO anti-starvation head-of-line blocking, TryAcquire waiter suppression, canceled waiter unblocking, and excess release panics
sha256:0cad4dd8b986e020f9eebd78f63e6c5a68bc3ffa5cb9d52f9d5f9d4b235d0ee9
PUBLISHED
L3_CONTRACT_PASS
MIT-0
実行証拠
宣言環境と署名済み検証実行を分け、証明範囲を明確にします。
証拠の基準署名済みコントラクト合格
検証レシート1
検証レベルL3_CONTRACT_PASS
宣言された環境
- 実行コンテキスト
- go
- OS
- linux
- アーキテクチャ
- x64
- ランタイム
- go
- 言語
- go
- パッケージマネージャー
- gomod
検証実行環境
- 実行コンテキスト
- go 1.26
- OS
- linux alpine · musl
- アーキテクチャ
- x64
- ランタイム
- go 1.26
- 言語
- go
- パッケージマネージャー
- gomod
- 実行方式
- container · docker
CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · golang@1 · 2026-08-17
ケース
- ゴール
- Handle semaphore weighted acquisition, FIFO anti-starvation head-of-line blocking, TryAcquire waiter suppression, canceled waiter unblocking, and excess release panics HOW
- パッケージ
-
golang.org/x/sync 0.22.0
- 環境
- go
- 作成日
- 2026-08-17T15:40:26Z
よくある思い込み
a weighted semaphore grants available capacity to incoming requests whenever unallocated tokens suffice, allowing small requests to bypass earlier larger queued waiters.
このサンプルの作者が、ここで開発者やモデルが期待するであろうこととして記録したもの。下の契約が実際に実行されたものだ。
コントラクト
- assert semaphore.Weighted enforces strict FIFO ordering so smaller Acquire requests remain blocked behind a larger head waiter even when sufficient unallocated tokens exist
- assert TryAcquire returns false whenever waiters are queued in the wait list even if unallocated capacity is available
- assert canceling a blocked head waiter context immediately unblocks subsequent queued waiters without requiring an additional Release
- assert calling Acquire with an already-canceled context returns context.Canceled immediately without modifying token capacity
- assert calling Release with a weight greater than currently held tokens panics immediately
ファイル
- NOTES.md
- contract_test.go
- csx.json
- go.mod
- go.sum
ソースアーティファクトをダウンロード (tar.gz)
オリジンシーダー
csx-seed
検証レシート
- go 1.26 · linux alpine/x64 · docker · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · golang@1 · 2026-08-17 · ed25519:d91480838ac982c9