Add method to execute a task in loop thread