use MVar as a lock when generating name