gen_sym.go 289 B

12345678910111213
  1. package gls
  2. var (
  3. symPool = &idPool{}
  4. )
  5. // ContextKey is a throwaway value you can use as a key to a ContextManager
  6. type ContextKey struct{ id uint }
  7. // GenSym will return a brand new, never-before-used ContextKey
  8. func GenSym() ContextKey {
  9. return ContextKey{id: symPool.Acquire()}
  10. }