MCPcopy Index your code
hub / github.com/klauspost/compress / timeout

Function timeout

zstd/decoder_test.go:2142–2162  ·  view source on GitHub ↗
(after time.Duration)

Source from the content-addressed store, hash-verified

2140}
2141
2142func timeout(after time.Duration) (cancel func()) {
2143 if isRaceTest {
2144 return func() {}
2145 }
2146 c := time.After(after)
2147 cc := make(chan struct{})
2148 go func() {
2149 select {
2150 case <-cc:
2151 return
2152 case <-c:
2153 buf := make([]byte, 1<<20)
2154 stacklen := runtime.Stack(buf, true)
2155 log.Printf("=== Timeout, assuming deadlock ===\n*** goroutine dump...\n%s\n*** end\n", string(buf[:stacklen]))
2156 os.Exit(2)
2157 }
2158 }()
2159 return func() {
2160 close(cc)
2161 }
2162}
2163
2164func TestWithDecodeAllCapLimit(t *testing.T) {
2165 var encs []*Encoder

Callers 10

TestEncoderRegressionFunction · 0.85
TestNewDecoderMemoryFunction · 0.85
TestNewDecoderFrameSizeFunction · 0.85
TestNewDecoderBadFunction · 0.85
TestNewDecoderFlushedFunction · 0.85
TestDecoderRegressionFunction · 0.85
testDecoderFileFunction · 0.85
testDecoderFileBadFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…