use std::mutex instead of pthread_mutex.

This in preparation for Windows port.