Get instance of Mutex class, and add wrapper function.

Signed-off-by: Krzysztof Wilczynski <krzysztof.wilczynski@linux.com>
Add naive synchronization via Mutex#lock and Mutex#unlock to make it a little bit more thread-safe.

Signed-off-by: Krzysztof Wilczynski <krzysztof.wilczynski@linux.com>