Fixed issue #1281, thread shutdown now properly waiting for quit.
Fixed possible race found by bmiklautz
Merge pull request #1458 from akallabeth/microphone_fixes

Fixed issue #1281, thread shutdown now properly waiting for quit.