added thread class and event timedwait