template delete of thread