Move console lock and unlock functions (which also handle thread cancelstate) to miner.h
Use common console locking function for stdout in logging.c
Bugfix: Also hold the console lock when writing to stderr
Write to both stderr and console within same console lock "session"
Short-circuit logging sooner in quiet mode
Merge branch 'stderr_lock' into bfgminer