Add interface for thread queue; Changed thread with template for queue type;