Working locks add

add working lock and fixed some errors
Finished CVs in synch.h and synch.c

control variables have been add to the two files synch.h and synch.c
Merge pull request #1 from frosteeze/working-lock-and-control-variables-

Working lock and control variables