made EventQueue thread safe