Closed mingregister closed 1 year ago
you can try it
func GoID() int { var buf [64]byte n := runtime.Stack(buf[:], false) idField := strings.Fields(strings.TrimPrefix(string(buf[:n]), "goroutine "))[0] id, err := strconv.Atoi(idField) if err != nil { panic(fmt.Sprintf("cannot get goroutine id: %v", err)) } return id }
What did you mean "max goroutine count"?
And like @xyhubl said, you can generate the custom goroutine ID if that's what you want.
Questions with details
I use the ants pool as the following snappet.
My Question is: How can I verifier the max goroutine count in pool is correct.
What had I try:
Code snippets (optional)
No response