[MRG] stl: don't acquire lock until dictionary generation is needed