Apply `define_lock()'

We have a nice macro for defining pthread mutexes, use it.
9 files changed