Added forgotten function, now initializing thread actually works.
Can wait for thread state change