finish the code, but has warning, need to test
try to pull
add some main code and update thread struct