using syncronization varibles for mutual exclusion