Add functionality for using event loops in different threads