thread and env