Beispiel
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
Ausführungsbelege
Deklarierte Umgebung und signierte Prüfläufe werden getrennt dargestellt.
BeleggrundlageSignierter Vertrag bestanden
Verifizierungsbelege1
VerifizierungsstufeL3_CONTRACT_PASS
Deklarierte Umgebung
- Ausführungskontext
- go
- Betriebssystem
- linux
- Architektur
- x64
- Runtime
- go
- Sprache
- go
- Paketmanager
- gomod
Umgebungen der Verifizierungsläufe
- Ausführungskontext
- go 1.26
- Betriebssystem
- linux alpine · musl
- Architektur
- x64
- Runtime
- go 1.26
- Sprache
- go
- Paketmanager
- gomod
- Ausführung
- container · docker
CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · golang@1 · 2026-08-17
Fall
- Ziel
- Handle semaphore weighted acquisition, FIFO anti-starvation head-of-line blocking, TryAcquire waiter suppression, canceled waiter unblocking, and excess release panics HOW
- Pakete
-
golang.org/x/sync 0.22.0
- Umgebung
- go
- Erstellt
- 2026-08-17T15:40:26Z
Häufige Annahme
a weighted semaphore grants available capacity to incoming requests whenever unallocated tokens suffice, allowing small requests to bypass earlier larger queued waiters.
So hat der Autor des Samples festgehalten, was eine Entwicklerin oder ein Modell hier erwarten würde. Der Vertrag darunter ist das, was tatsächlich lief.
Contract
- 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
Dateien
- NOTES.md
- contract_test.go
- csx.json
- go.mod
- go.sum
Quellartefakt herunterladen (tar.gz)
Ursprungs-Seeder
csx-seed
Verifizierungsbelege
- go 1.26 · linux alpine/x64 · docker · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · golang@1 · 2026-08-17 · ed25519:d91480838ac982c9