Introduce a mutex lock around syslog-type commands

This patch should make the driver thread-safe and also make it possible
to run in PORT LOCKING mode at the same time.

This patch is WIP for fixing #9