Enhance alsa_hook async signal safety

Conserve errno value as it was when calling the write ALSA hooks
Remove some non async-signal safe functions calls from functions
potentially being called from sighandlers.
Fix 1-2 write lock/unlock mismatches.