1
0
mirror of https://github.com/DataDog/go-profiler-notes.git synced 2025-07-12 23:50:13 +02:00

Initial work on new guide

This commit is contained in:
Felix Geisendörfer
2021-09-08 11:25:15 +02:00
parent 74c8c4298c
commit fd511c528d
33 changed files with 11311 additions and 0 deletions

28
guide/heap.go Normal file
View File

@ -0,0 +1,28 @@
// +build ignore
package main
import (
"fmt"
"sync"
"sync/atomic"
)
func main() {
var (
sum int32
wg = &sync.WaitGroup{}
)
wg.Add(2)
go add(&sum, 23, wg)
go add(&sum, 42, wg)
wg.Wait()
fmt.Println(sum)
}
func add(dst *int32, delta int32, wg *sync.WaitGroup) {
atomic.AddInt32(dst, delta)
wg.Done()
}