huandu / go-tls

A bit safer approach to implement Thread Local Storage (TLS) for Go 1.7+.
MIT License
162 stars 15 forks source link

Question about using g struct pointer to identify a goroutine #1

Closed liudanking closed 6 years ago

liudanking commented 6 years ago

I am looking for a lib to identify a goroutine, and I don't like to use goroutine id.

This lib is promising.

And I have a question: goroutine may migrate between system threads, using g struct pointer to identify a goroutine may be not reliable. What do you think about this situation?

liudanking commented 6 years ago

I figure it out that goroutine address seems immutable. So using g struct pointer to identify a goroutine is OK.