Added conditional variables (pthread only atm) and implemented mutex with pthread.