wrap events run in thread