Use sync.RWMutex to protect the map storing the listeners.

Unfortunately, this slows down calls to T() by more than a factor of
10 (in the absence of listeners), but I have not yet found a faster,
correct implementation.