Add abstractions for threading primitives

This is some simple code to have pthread primitives be a bit more user
friendly and C++11-threads like. Added classes for mutex, a simple lock
and a condition variable. Didn't add a thread class as that seems to be
rather complicated, thus they still must be created within ifdef guards.