added pthread conditions