Tweak windows build environment.
Fix compiler warning.
Don't use a pthread_t as a normal simple type.

Not on all platforms a pthread_t is a simple type and as such you cannot
normally determine if its initialized or not. So for the allocation of
the SD message channel we now use a bool that gets set when the thread
is running and needs teardown.