goroutine

package module
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: May 23, 2024 License: BSD-3-Clause Imports: 2 Imported by: 5

README

goroutine identification

Package goroutine provides functions that will return the runtime's ID number for the calling goroutine or its creator.

The implementation is derived from Laevus Dexter's comment in Gophers' Slack #darkarts, https://gophers.slack.com/archives/C1C1YSQBT/p1593885226448300 post which linked to this playground snippet https://play.golang.org/p/CSOp9wyzydP.

The code here is an exercise in minimalism, doing as little as possible by deferring nearly all of the logic to runtime functions co-opted via //go:linkname comments.

Documentation

Overview

Package goroutine provides functions that will return the runtime's ID number for the calling goroutine or its creator.

The implementation is derived from Laevus Dexter's comment in Gophers' Slack #darkarts, https://gophers.slack.com/archives/C1C1YSQBT/p1593885226448300 post which linked to this playground snippet https://play.golang.org/p/CSOp9wyzydP.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ID

func ID() int64

ID returns the runtime ID of the calling goroutine.

func ParentID added in v1.1.0

func ParentID() int64

ParentID returns the runtime ID of goroutine that created the calling goroutine.

Types

This section is empty.

Jump to

Keyboard shortcuts

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