emit events in scheduler
exit thread only when event_queue is empty