GITLAB

Hermes / api-game

Sign in
  • Sign in
  • Project
  • Files
  • Commits
  • Network
  • Graphs
  • Issues 0
  • Merge Requests 0
  • Wiki
  • api-game_qianyi
  • util
  • utmisc
  • goroutine.go
  • 724ed661   feat✨:房间排行活动逻辑 Browse Code »
    王家文
    2024-04-18 12:17:24 +0800  
goroutine.go 229 Bytes
Edit Raw Blame History Permalink
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
package utmisc

import (
	"fmt"
	"runtime"
)

// GetGoroutineID 获取携程ID
func GetGoroutineID() int {
	var buf [64]byte
	runtime.Stack(buf[:], false)
	var id int
	fmt.Sscanf(string(buf[:]), "goroutine %d", &id)
	return id
}