Thread safety for modules