goid

package
v0.4.153 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 2, 2024 License: ISC Imports: 3 Imported by: 0

Documentation

Overview

Package goid obtaines a thread’s parl.ThreadID unique goroutine identifier.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GoID

func GoID() (threadID parl.ThreadID)

GoID obtains a numeric string that as of Go1.18 is assigned to each goroutine

  • goid 64-bit integer number incremented from 1 for the main invocation thread
  • cache this value, it is expensive at 1.7 parallel mutex Lock/Unlock via pruntime.FirstStackLine

Usage:

m := map[goid.ThreadID]SomeInterface{}
cachedGoID := goid.GoID()
m[cachedGoID] = …

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL