add cleanup.c
thread create, join, cleanup on exit