Added thread_detach functionality. Memory management of joinable and detached threads is not POSIX compatible