Create on-the-fly thread and destroy it when finished.