add detach thread switch

设置detach状态有助于加快退出速度. 还需要测试更多

Signed-off-by: xiehuc <xiehuc@gmail.com>