Mutex extension.

Fixes #372: implement Mutex component.
Rework of the #568.