Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
53 lines (40 sloc) 943 Bytes
package etw
import (
// Because the provider callback function needs to be able to access the
// provider data when it is invoked by ETW, we need to keep provider data stored
// in a global map based on an index. The index is passed as the callback
// context to ETW.
type providerMap struct {
m map[uint]*Provider
i uint
lock sync.Mutex
once sync.Once
var providers = providerMap{
m: make(map[uint]*Provider),
func (p *providerMap) newProvider() *Provider {
defer p.lock.Unlock()
i := p.i
provider := &Provider{
index: i,
p.m[i] = provider
return provider
func (p *providerMap) removeProvider(provider *Provider) {
defer p.lock.Unlock()
delete(p.m, provider.index)
func (p *providerMap) getProvider(index uint) *Provider {
defer p.lock.Unlock()
return p.m[index]
var providerCallbackOnce sync.Once
var globalProviderCallback uintptr
You can’t perform that action at this time.