Require the thread library where Mutex is used.

Closes #941.
Merge branch 'stable'