Require the thread library where Mutex is used.

Closes #941.