diff --git a/gid.go b/gid.go index 1d42523..436d97b 100644 --- a/gid.go +++ b/gid.go @@ -1,14 +1,14 @@ package gls -var ( - stackTagPool = &idPool{} +import ( + "golang.design/x/lockfree" ) -func initIdPool() { - stackTagPool.Pool.New = func() interface{} { - return stackTagPool.newID() +var ( + stackTagPool = &idPool{ + queue: lockfree.NewQueue(), } -} +) // Will return this goroutine's identifier if set. If you always need a // goroutine identifier, you should use EnsureGoroutineId which will make one diff --git a/stack_tags.go b/stack_tags.go index 39519ff..f69e39e 100644 --- a/stack_tags.go +++ b/stack_tags.go @@ -40,8 +40,6 @@ func init() { setEntries(github_com_jtolds_gls_markD, 0xd) setEntries(github_com_jtolds_gls_markE, 0xe) setEntries(github_com_jtolds_gls_markF, 0xf) - - initIdPool() } func addStackTag(tag uint32, context_call func()) {