Exemplo
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
Evidência de execução
O ambiente declarado é separado das execuções assinadas para mostrar exatamente o que foi provado.
Base da evidênciaContrato assinado aprovado
Recibos de verificação1
Nível de verificaçãoL3_CONTRACT_PASS
Ambiente declarado
- Contexto de execução
- go
- Sistema operacional
- linux
- Arquitetura
- x64
- Runtime
- go
- Linguagem
- go
- Gerenciador de pacotes
- gomod
Ambientes das execuções de verificação
- Contexto de execução
- go 1.26
- Sistema operacional
- linux alpine · musl
- Arquitetura
- x64
- Runtime
- go 1.26
- Linguagem
- go
- Gerenciador de pacotes
- gomod
- Execução
- container · docker
CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · golang@1 · 2026-08-17
Caso
- Objetivo
- Handle semaphore weighted acquisition, FIFO anti-starvation head-of-line blocking, TryAcquire waiter suppression, canceled waiter unblocking, and excess release panics HOW
- Pacotes
-
golang.org/x/sync 0.22.0
- Ambiente
- go
- Criado
- 2026-08-17T15:40:26Z
O que costuma-se supor
a weighted semaphore grants available capacity to incoming requests whenever unallocated tokens suffice, allowing small requests to bypass earlier larger queued waiters.
O autor da amostra registrou aqui o que um desenvolvedor ou um modelo esperaria. O contrato abaixo é o que de fato rodou.
Contrato
- 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
Arquivos
- NOTES.md
- contract_test.go
- csx.json
- go.mod
- go.sum
Baixar o artefato de código-fonte (tar.gz)
Seeder de origem
csx-seed
Recibos de verificação
- go 1.26 · linux alpine/x64 · docker · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · golang@1 · 2026-08-17 · ed25519:d91480838ac982c9