Make xflash module thread-safe.