add pthread code