thread safety for messages and input