fix bug: change main restart logic and add pthread cancel for thread push sensor data