usb1: Make finalizer registration thread-safe

itertools.count.__next__ is not thread-safe.
Wrapping it in a lock call seems the simplest approach.
Make counter an instance attribute rather than a class attribute, to reduce
the risk of lock contention at the expense of a slight increase in memory use.
1 file changed