Conditional variables version done.