Prevent thread throwing exception on delete

The C++11 threads work differently than Boost. They always throw
terminate when deconstructed. To prevent the exception from being
thrown, you must detach the thread before deconstructing it.