Make static variable initialization thread-safe.

This should be enough to allow creation of barcodes from a background queue.