added pthread creation and termination