This fixes the race condition in Emit. Because Emit now read locks the map I also had to change Once so that it doesn't deadlock. If you don't like the remove in a separate go-routine, another option would be check for the oneTime type in Emit and remove it at the end.
This fixes the race condition in Emit. Because Emit now read locks the map I also had to change Once so that it doesn't deadlock. If you don't like the remove in a separate go-routine, another option would be check for the oneTime type in Emit and remove it at the end.