1
2
3
4
5
14 package main
15
16 import (
17 "context"
18 "os"
19 "runtime"
20 "runtime/pprof"
21 )
22
23 func init() {
24 register("Cockroach13197", Cockroach13197)
25 }
26
27 type DB_cockroach13197 struct{}
28
29 func (db *DB_cockroach13197) begin(ctx context.Context) *Tx_cockroach13197 {
30 ctx, cancel := context.WithCancel(ctx)
31 tx := &Tx_cockroach13197{
32 cancel: cancel,
33 ctx: ctx,
34 }
35 go tx.awaitDone()
36 return tx
37 }
38
39 type Tx_cockroach13197 struct {
40 cancel context.CancelFunc
41 ctx context.Context
42 }
43
44 func (tx *Tx_cockroach13197) awaitDone() {
45 <-tx.ctx.Done()
46 }
47
48 func (tx *Tx_cockroach13197) Rollback() {
49 tx.rollback()
50 }
51
52 func (tx *Tx_cockroach13197) rollback() {
53 tx.close()
54 }
55
56 func (tx *Tx_cockroach13197) close() {
57 tx.cancel()
58 }
59
60
61
62
63
64
65
66
67
68
69
70 func Cockroach13197() {
71 prof := pprof.Lookup("goroutineleak")
72 defer func() {
73
74 for i := 0; i < yieldCount; i++ {
75 runtime.Gosched()
76 }
77 prof.WriteTo(os.Stdout, 2)
78 }()
79
80 db := &DB_cockroach13197{}
81 db.begin(context.Background())
82 }
83
View as plain text