do not try to detach a thread that isn't running yet
Merge pull request #1016 from rainers/unittest_thread_detach

Fix unittest in core.thread