implemented a new way to stop thread and restart

Signed-off-by: Liew Zhao Wei <zhaoweiliew@gmail.com>