convert the blinker into C++ thread